Closed erickpatrick closed 1 year ago
Thanks for the bug report and the helpful test repo! I added commonjs support and published a release candidate here: https://www.npmjs.com/package/edge-csrf/v/0.2.2-rc1
Can you try out v0.2.2-rc1 and let me know if that fixes the problem? I can work on the Next.js 13 upgrade next.
Hi @amorey, I'm checking it now. Thank you for you quick update :)
Hi @amorey, I've just tested it and it works as expected now. Many thanks for your quick work!
Great! Happy to hear it fixed the problem. I published the changes as v0.2.2: https://www.npmjs.com/package/edge-csrf/v/0.2.2
In addition I just published a release candidate for a version that includes Next.js 13 support: https://www.npmjs.com/package/edge-csrf/v/1.0.0-rc1
If you get a chance, please try that one out as well and let me know if you notice any problems.
Hi @amorey, I will test it this weekend with Next.js v13 and will feedback latest on Monday :)
Many thanks for your work :)
Version 0.2.1
Steps to reproduce The following public repository contains a minimum replication environment: https://github.com/erickpatrick/nextjs-jest-edge-csrf-minimum-reproduction
npm install --force
--force
is required asedge-csrf
requires Next.js v12 though repo uses Next.js v13npm run test
Description of the repository The repository is a Next.js app. It was setup using the Jest Testing documentation from Next.js docs website.
The project contains the
<rootDir>/myFile.ts
file which usesedge-csrf
. A companion test file,<rootDir>/myFyle.test.ts
, contains a minimum test file where we try to test<rootDir>/myFile.ts
functionality.Actual behavior When running
npm run test
, Jest throws the following error:Expected Behavior After running
npm run test
, Jest's logs from successful or failed test runs should display. In other words, the files fromedge-csrf
repository would provide files already transformed to a low level enough (CommonJS, perhaps) which would allownpm run test
to behave as expected.Additional Context Attention to the
**SyntaxError: Cannot use import statement outside a module**
message. I've tried to follow Jest's documentation on how to add files fromnode_modules
to be transformed, but it did not work.I have also tried to define a
babel.config.js
like in the documentation and configuring it in order to transform the files fromedge-csrf
. However, it also did not work.Environment System:
Binaries:
/usr/local/bin/node
/usr/local/bin/npm