Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal Invocation from createClock #170

Closed
dpogue opened this issue May 8, 2018 · 11 comments
Closed

Illegal Invocation from createClock #170

dpogue opened this issue May 8, 2018 · 11 comments

Comments

@dpogue
Copy link

dpogue commented May 8, 2018

Just updated lolex and started getting a bunch of test failures with this error:

TypeError: Illegal invocation
  at webpack:///node_modules/lolex/lolex.js:746:0 <- webpack.tests.js:77738:52
  at Array.forEach (<anonymous>)
  at createClock (webpack:///node_modules/lolex/lolex.js:745:0 <- webpack.tests.js:77737:18)
  at Object.install (webpack:///node_modules/lolex/lolex.js:796:0 <- webpack.tests.js:77788:21)
  at ./node_modules/sinon/lib/sinon/util/fake_timers.js.exports.useFakeTimers (webpack:///node_modules/sinon/lib/sinon/util/fake_timers.js:29:0 <- webpack.tests.js:125808:21)
  at Sandbox.useFakeTimers (webpack:///node_modules/sinon/lib/sinon/sandbox.js:310:0 <- webpack.tests.js:123807:46)

Tests are being run in Chrome 68 headless.

@fatso83
Copy link
Contributor

fatso83 commented May 8, 2018

Not good. Thanks for reporting! Which version worked? Any reproducible code? Hard to dig into without a test case.

@dpogue
Copy link
Author

dpogue commented May 9, 2018

It looks like both 2.4.0 and 2.4.1 are broken, but 2.3.2 works.

It seems to happen as soon as a test calls sinon.useFakeTimers()

@mantoni
Copy link
Member

mantoni commented May 9, 2018

This also looks like the issue I addressed here: https://github.com/sinonjs/lolex/pull/162/files

I also ran into this when trying to run the lolex tests in headless chrome.

@SimenB
Copy link
Member

SimenB commented May 9, 2018

Yeah, I think it's the same as #162 and #167

@mermaid
Copy link

mermaid commented May 9, 2018

This started happening to me yesterday as well. I get TypeError: Illegal invocation in headless chrome (and normal chrome as well) as soon as we try to use fake Timers

@barcicki
Copy link

Versions 2.4.0 and 2.4.1 also don't work on Firefox.

You can see it in build result: https://travis-ci.org/sinonjs/lolex/jobs/376426623#L2348

@fatso83
Copy link
Contributor

fatso83 commented May 11, 2018

Fixed by #162. Released as 2.4.2.

@akihikodaki
Copy link

I'm worrying I may have done something wrong as other people say it is fixed, but it still doesn't work for me. I ran a minimal code on console to reproduce the issue to make sure my NPM installation does not affect the result:

navigator.userAgent
// Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
const value = Object.create(performance);
Object.getOwnPropertyNames(window.Performance.prototype)
// (17) ["timeOrigin", "onresourcetimingbufferfull", "timing", "navigation", "memory", "now", "getEntries", "getEntriesByType", "getEntriesByName", "clearResourceTimings", "setResourceTimingBufferSize", "mark", "clearMarks", "measure", "clearMeasures", "toJSON", "constructor"]
Object.getOwnPropertyDescriptor(Performance.prototype, 'mark').writable
// true
value.mark = Performance.prototype.mark;
Object.defineProperty(window, 'performance', { writable: false, value });
performance.mark('foo');
// VM130:1 Uncaught TypeError: 'Illegal invocation'

Can anyone confirm this, or point out a mistake?

@TeaSeaLancs
Copy link

Confirmed, this is still broken on my build as of Sinon release 6.1.5, which is running lolex 2.7.1.

@fatso83 fatso83 reopened this Aug 30, 2018
@TeaSeaLancs
Copy link

Just to clarify my confirmation as well, this is occurring in Chrome and Headless Chrome.

@fatso83
Copy link
Contributor

fatso83 commented Sep 5, 2018

The comments on this still being a thing probably point to #200, which a PR I sent in is about to close (hopefully). Closing this while keeping #200 open, as I suspect some comments are basically duplicates.

@fatso83 fatso83 closed this as completed Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants