-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Running import { test, fc } from '@fast-check/jest';
results in error reading properties of undefined in jest
#4986
Comments
This line in node_modules/@fast-check/jest/lib/esm/jest-fast-check.js.
Doesn't work as |
This is the latest version of jest. So I don't think the |
Strange... I have some tests checking ES Module mode 🤔 (tests here) In he meantime, a shorter and minimal reproduction case could help me into investigating. Current test case is a bit too huge to start an investigation without loosing time trying to understand how the project works, is setup... |
I'll probably check and extend my tests to use the test and not the testProp thing so that it gets closer to my latest recommendations. |
Well I sort of debugged it by editing these 3 files:
Monkey patching it with I don't think |
If you have If not, an |
Closing, cannot repro, no minimal case provided. Sorry, I have to close, I cannot spend time on investigating on exotic setups. If you want me to investigate something please feel free to re-open with a minimal reproduction not forcing me to download many modules unrelated to the bug itself. A case with fast-check plus the test runner you used should probably be enough to reproduce the issue. |
i think it turns out to be something to do with importing from diff --git a/node_modules/@fast-check/jest/lib/jest-fast-check.js b/node_modules/@fast-check/jest/lib/jest-fast-check.js
index 9fe5a3d..8d2c980 100644
--- a/node_modules/@fast-check/jest/lib/jest-fast-check.js
+++ b/node_modules/@fast-check/jest/lib/jest-fast-check.js
@@ -1,5 +1,5 @@
import * as fc from 'fast-check';
-import { it as itJest, test as testJest, jest } from '@jest/globals';
+const { it: itJest, test: testJest, jest } = globalThis;
import { buildTest } from './internals/TestBuilder.js';
export const test = buildTest(testJest, jest, fc);
export const it = buildTest(itJest, jest, fc); The reason for this is because importing |
Why not. Let's try. CI should warn us if it breaks something |
Do you want a PR to just do the above patch? |
Go ahead, yes 👍 |
🐛 Bug Report
I'm trying to use the latest ESM version of
@fast-check/jest
. I got everything else working.As soon as I try to import
import { test, fc } from '@fast-check/jest';
there seems to be some problem with some undefined property.Seems something isn't quite working..
To Reproduce
Steps to reproduce:
npm test
Expected behavior
Clear and concise description of what you expected to happen.
That it just imports properly.
If you have one, please provide a minimal repository reproducing the issue on GitHub.
Your environment
*Only for TypeScript's users
The text was updated successfully, but these errors were encountered: