fix(aio): fix PWA testing in cases where `atob`/`btoa` is necessary
In some cases (unclear when), traceviewer-js, used by Lighthouse under the hood, assumes `atob`/`btoa` are defined in the global scope. This is true for browser environments, but not on node. As a result, some aggregations that required access to model-tracing failed to produce results, dropping the overall PWA score. This affected #16665 (e.g. commit 0de6eec7a).
This commit is contained in:
parent
baa3fbab46
commit
b40aae54b7
|
@ -20,6 +20,10 @@ const config = require('lighthouse/lighthouse-core/config/default.json');
|
|||
// Constants
|
||||
const FLAGS = {output: 'json'};
|
||||
|
||||
// Work-around traceviewer-js bug.
|
||||
global.atob = str => new Buffer(str, 'base64').toString('binary');
|
||||
global.btoa = str => new Buffer(str, 'binary').toString('base64');
|
||||
|
||||
// Specify the path to Chrome on Travis
|
||||
if (process.env.TRAVIS) {
|
||||
process.env.LIGHTHOUSE_CHROMIUM_PATH = process.env.CHROME_BIN;
|
||||
|
|
Loading…
Reference in New Issue