Jest matcher utils dependency upgrade
detljh opened this issue · 4 comments
Since upgading to Angular 12 and Webpack 5, this package no longer works when running tests and errors with
Chrome 91.0.4472.114 (Linux x86_64) ERROR
An error was thrown in afterAll
Uncaught ReferenceError: Buffer is not defined
ReferenceError: Buffer is not defined
at Object.45513 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js:18:1)
at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Object.79283 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/jest-matcher-utils/build/index.js:19:3)
at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Object.53442 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rx-sandbox/dist/assert/marbleAssert.js:9:55)
at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Object.89949 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rx-sandbox/dist/index.js:4:24)
at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at Module.534 (http://localhost:9876/_karma_webpack_/main.js:2450:68)
Could the jest-matcher-utils
package be upgraded to the latest version #663 as it might solve this issue
Upgrading dep is easy, but error stack sounds like it's coming from different reason. Isn't the case webpack@5 no longer polyfills node.js and Buffer is not being found due to those reason?
I'm not in front of machine so it's all guess though.
Yeah I'm not entirely sure if this will solve everything but in the latest version of jest-matcher-utils
it looks like they removed Buffer
from builtInObject
https://github.com/facebook/jest/blob/fdc74af37235354e077edeeee8aa2d1a4a863032/packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts
I peeked this bit, there are 2 dependencies rx-sandbox uses from jest (expect
, jest-matcher-utils
) need to be bumped altogether. But expect
have breaking changes to not allow subpath import for non-public interfaces rx-sandbox uses, so it is not possible to bump easily at this moment. It may need to be replaced into something else maybe.