Skip to content

Commit

Permalink
tests(web-inspector): add test for setImmediate polyfill (#3670)
Browse files Browse the repository at this point in the history
* tests(web-inspector): add test for setImmediate polyfill

* change name, add comment
  • Loading branch information
patrickhulce authored Oct 27, 2017
1 parent 5bc3b84 commit 76e51f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lighthouse-core/test/lib/web-inspector-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ describe('Web Inspector lib', function() {
assert.ok(WebInspector.Color);
});

it('does not polyfill setImmediate incorrectly', done => {
const fakeArg = {
foo() {},
};

setImmediate(function(arg) {
try {
arg.foo(); // make sure setImmediate passed the fakeArg
done();
} catch (err) {
done(err);
}
}, fakeArg);
});

// Our implementation of using DevTools doesn't sandbox natives
// In the future, it'd be valuable to handle that so lighthouse can safely
// be consumed as a lib, without dirtying the shared natives
Expand Down

0 comments on commit 76e51f3

Please sign in to comment.