Test failing since Node 18.8.0
mroderick opened this issue · 2 comments
While working on #439 and #440 with @hexeberlin, we discovered that one unit test is failing since Node 18.8.0
1) FakeTimers
stubTimers
should replace the getEntries, getEntriesByX methods with noops that return []:
TypeError: Cannot assign to read only property 'getEntries' of object '#<Performance>'
at Context.<anonymous> (test/fake-timers-test.js:3884:50)
at process.processImmediate (node:internal/timers:471:21)
How to reproduce
nmv install 18.7
npm run test-node
- Observe all tests pass
nvm install 18.8
npm run test-node
- Observe one test fails
Since this library is downloaded more ~19M times/month and Node 18 has been out for about a month and we have yet to see any error reports about failures in newer Node 18 versions, I think it's safe to say that it's only the test that is failing.
We should fix this soon, as the failing test is preventing us from merging pull requests (or alternatively, we should lock the Node 18 version to 18.7, while we fix this issue).
Plot twist: the tests pass fine in Node v19.0.0
Looking into this. Seems to be some kind of weird runtime issue:
Essentially, if I configure the property descriptor in a debugger with the line from the code, it works. If it is just Node running on its own, it has no effect and fails.
Object.defineProperty(Performance.prototype, "getEntries", { writable: true })
Ha, no, this is just about spelling! I corrected the spelling when doing this. The prop is called writable
, but we have used writeable
🤣