parent
ed4be10ae3
commit
37cc9f567d
@ -687,7 +687,7 @@ class Page extends EventEmitter {
|
|||||||
console.assert(options.type === 'png' || options.type === 'jpeg', 'Unknown options.type value: ' + options.type);
|
console.assert(options.type === 'png' || options.type === 'jpeg', 'Unknown options.type value: ' + options.type);
|
||||||
screenshotType = options.type;
|
screenshotType = options.type;
|
||||||
} else if (options.path) {
|
} else if (options.path) {
|
||||||
const mimeType = mime.lookup(options.path);
|
const mimeType = mime.getType(options.path);
|
||||||
if (mimeType === 'image/png')
|
if (mimeType === 'image/png')
|
||||||
screenshotType = 'png';
|
screenshotType = 'png';
|
||||||
else if (mimeType === 'image/jpeg')
|
else if (mimeType === 'image/jpeg')
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
"author": "The Chromium Authors",
|
"author": "The Chromium Authors",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^2.6.8",
|
"debug": "^3.1.0",
|
||||||
"extract-zip": "^1.6.5",
|
"extract-zip": "^1.6.5",
|
||||||
"https-proxy-agent": "^2.1.0",
|
"https-proxy-agent": "^2.1.0",
|
||||||
"mime": "^1.3.4",
|
"mime": "^2.0.3",
|
||||||
"progress": "^2.0.0",
|
"progress": "^2.0.0",
|
||||||
"proxy-from-env": "^1.0.0",
|
"proxy-from-env": "^1.0.0",
|
||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/debug": "0.0.30",
|
"@types/debug": "0.0.30",
|
||||||
"@types/extract-zip": "^1.6.2",
|
"@types/extract-zip": "^1.6.2",
|
||||||
"@types/mime": "^1.3.1",
|
"@types/mime": "^2.0.0",
|
||||||
"@types/node": "^8.0.26",
|
"@types/node": "^8.0.26",
|
||||||
"@types/rimraf": "^2.0.2",
|
"@types/rimraf": "^2.0.2",
|
||||||
"@types/ws": "^3.0.2",
|
"@types/ws": "^3.0.2",
|
||||||
|
@ -93,11 +93,11 @@ function compare(goldenPath, outputPath, actual, goldenName) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const expected = fs.readFileSync(expectedPath);
|
const expected = fs.readFileSync(expectedPath);
|
||||||
const comparator = GoldenComparators[mime.lookup(goldenName)];
|
const comparator = GoldenComparators[mime.getType(goldenName)];
|
||||||
if (!comparator) {
|
if (!comparator) {
|
||||||
return {
|
return {
|
||||||
pass: false,
|
pass: false,
|
||||||
message: 'Failed to find comparator with type ' + mime.lookup(goldenName) + ': ' + goldenName
|
message: 'Failed to find comparator with type ' + mime.getType(goldenName) + ': ' + goldenName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const result = comparator(actual, expected);
|
const result = comparator(actual, expected);
|
||||||
|
@ -234,7 +234,7 @@ class SimpleServer {
|
|||||||
response.end(`File not found: ${filePath}`);
|
response.end(`File not found: ${filePath}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.setHeader('Content-Type', mime.lookup(filePath));
|
response.setHeader('Content-Type', mime.getType(filePath));
|
||||||
response.end(data);
|
response.end(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user