Various adaptations for Phantomas v2
This commit is contained in:
@@ -312,7 +312,7 @@ var policies = {
|
||||
list: offenders.map(function(offender) {
|
||||
if (offender === '[inline CSS]') {
|
||||
return {
|
||||
error: 'Empty style tag',
|
||||
error: 'Empty <style> tag',
|
||||
file: null,
|
||||
line: null,
|
||||
column: null
|
||||
@@ -321,17 +321,19 @@ var policies = {
|
||||
|
||||
if (offender.value) {
|
||||
return {
|
||||
error: offender.value.message || 'Unknown parsing error' + (parts[1] ? '. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.' : ''),
|
||||
file: offender.file || null,
|
||||
error: offender.value.message || 'Unknown parsing error. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.',
|
||||
file: offender.url || null,
|
||||
line: offender.value.position ? offender.value.position.start.line : null,
|
||||
column: offender.value.position ? offender.value.position.start.column : null
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
error: 'Unknown parsing error. The entire file was ignored. As a result, the other CSS metrics and scores are miscalculated.',
|
||||
file: offender,
|
||||
line: null,
|
||||
column: null
|
||||
};
|
||||
}
|
||||
|
||||
debug('cssParsingErrors offenders transform function error with "%s"', offender);
|
||||
return {
|
||||
parseError: offender
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
@@ -65,32 +65,11 @@ var PhantomasWrapper = function() {
|
||||
options.proxy = task.options.proxy;
|
||||
}
|
||||
|
||||
// Output the command line for debugging purpose
|
||||
debug('If you want to reproduce the phantomas task only, copy the following command line:');
|
||||
var optionsString = '';
|
||||
for (var opt in options) {
|
||||
var value = options[opt];
|
||||
|
||||
if ((typeof value === 'string' || value instanceof String) && value.indexOf(' ') >= 0) {
|
||||
value = '"' + value + '"';
|
||||
}
|
||||
|
||||
if (value === true) {
|
||||
optionsString += ' ' + '--' + opt;
|
||||
} else if (value === false || value === null || value === undefined) {
|
||||
// Nothing
|
||||
} else {
|
||||
optionsString += ' ' + '--' + opt + '=' + value;
|
||||
}
|
||||
|
||||
}
|
||||
debug('node node_modules/phantomas/bin/phantomas.js --url=' + task.url + optionsString + ' --verbose');
|
||||
|
||||
|
||||
// It's time to launch the test!!!
|
||||
|
||||
const promise = phantomas(task.url, {
|
||||
'analyze-css': true
|
||||
'analyze-css': true,
|
||||
'screenshot': true
|
||||
});
|
||||
|
||||
// handle the promise
|
||||
|
||||
Reference in New Issue
Block a user