Sign in
Log inSign up
Sagarpreet Chadha

40 likes

·

998 reads

1 comment

Pedro Saratscheff
Pedro Saratscheff
Dec 16, 2022

Hi! I tried to follow the steps, but it seems Chapter 4.

I tried to reproduce the steps, but I get the following error:

TypeError: Invalid value used as weak map key
        at WeakMap.set (<anonymous>)

      4 | import FSPersister from "@pollyjs/persister-fs";
      5 |
    > 6 | Polly.register(NodeHttpAdapter);
        |       ^
      7 | Polly.register(FSPersister);
      8 |
      9 | let recordIfMissing = true;

      at WeakMap.<anonymous> (../node_modules/core-js/library/modules/_collection.js:40:34)
      at Function.set [as register] (../node_modules/@pollyjs/core/src/polly.js:122:28)
[...]

It seems to be an issue with newer library version, the only one that I could work with was 5.1.1, which is the one PollyJs uses in their typescript-jest-node-fetch example.

Sadly, that version is now too old and won't work with newer versions of ECMA modules (it uses ES5).

Have you had any luck running the steps you followed with newer versions of PollyJs (6.0.0+)? Have you considered sharing the code you used for this post in a Github repository?

·