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

TypeError: 'mark' called on an object that does not implement interface Performance #200

Closed
su-kialo opened this issue Aug 17, 2018 · 1 comment

Comments

@su-kialo
Copy link

  • Lolex version: 2.7.1
  • Environment: Firefox 62.0b17 - macOS 10.13.6
  • Other libraries you are using: ReactDOM (development)

What did you expect to happen?
No Error to be thrown

What actually happens
A TypeError was thrown
TypeError: 'mark' called on an object that does not implement interface Performance

How to reproduce
lolex.install();
This happens when using the default lolex.install();

When subsequently calling performance.mark(), the TypeError is thrown (in my case, performance.mark is called by ReactDOM.development)

A workaround for this issue that I have found is to use this instead:
lolex.install({ toFake: [ 'setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date', 'nextTick', 'hrtime', ], });

Based on my preliminary research, it looks like this issue may have been introduced by #160 in response to issue #136
I am unsure if this method of recreating the performance object on the clock is carrying over the underlying interface type.

@fatso83
Copy link
Contributor

fatso83 commented Sep 4, 2018

Veriifed by adding this test and running npm run test-headless

            it("should not throw an error on calling performance.mark", function() {
                this.clock = lolex.install();
                assert.isFunction(global.performance.mark);
                refute.exception(function() {
                    global.performance.mark("a name");
                });
            });

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

2 participants