diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index f2584be0d6bf..2dfe7e5fc0b8 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -448,8 +448,7 @@ class Driver { * @return {Promise<*>} */ async evaluateAsync(expression, options = {}) { - const contextId = - options.useIsolation ? await this._getOrCreateIsolatedContextId() : undefined; + const contextId = options.useIsolation ? await this._getOrCreateIsolatedContextId() : undefined; try { // `await` is not redundant here because we want to `catch` the async errors diff --git a/lighthouse-core/test/lib/page-functions-test.js b/lighthouse-core/test/lib/page-functions-test.js index 7b3427bebb49..6606b82dc860 100644 --- a/lighthouse-core/test/lib/page-functions-test.js +++ b/lighthouse-core/test/lib/page-functions-test.js @@ -20,15 +20,13 @@ describe('createEvalCode', () => { const code = pageFunctions.createEvalCode(mainFn, { mode: 'iife', }); - expect(code).toMatchInlineSnapshot(` - "(() => { - - function mainFn() { - return true; - } - return mainFn(); - })()" - `); + expect(code).toEqual(`(() => { + + function mainFn() { + return true; + } + return mainFn(); + })()`); expect(eval(code)).toEqual(true); }); @@ -47,27 +45,25 @@ describe('createEvalCode', () => { deps: [abs, square], mode: 'iife', }); - expect(code).toMatchInlineSnapshot(` - "(() => { - function abs(val) { - return Math.abs(val); - } - function square(val) { - return val * val; - } - function mainFn({ - a, - b - }, passThru) { - return { - a: abs(a), - b: square(b), - passThru - }; - } - return mainFn({\\"a\\":-5,\\"b\\":10},\\"hello\\"); - })()" - `); + expect(code).toEqual(`(() => { + function abs(val) { + return Math.abs(val); + } +function square(val) { + return val * val; + } + function mainFn({ + a, + b + }, passThru) { + return { + a: abs(a), + b: square(b), + passThru + }; + } + return mainFn({"a":-5,"b":10},"hello"); + })()`); expect(eval(code)).toEqual({a: 5, b: 100, passThru: 'hello'}); }); @@ -83,17 +79,15 @@ describe('createEvalCode', () => { mode: 'function', deps: [adder], }); - expect(code).toMatchInlineSnapshot(` - "function () { - function adder(a, b) { - return a + b; - } - function mainFn(a, b) { - return adder(a, b); - } - return mainFn.call(this, 1,2); - }" - `); + expect(code).toEqual(`function () { + function adder(a, b) { + return a + b; + } + function mainFn(a, b) { + return adder(a, b); + } + return mainFn.call(this, 1,2); + }`); expect(eval(`(${code})()`)).toEqual(3); }); });