-
Notifications
You must be signed in to change notification settings - Fork 42
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
[WIP] Jest globals 2 #65
base: jest-globals
Are you sure you want to change the base?
Conversation
This reverts commit 7959831.
TODO: add tests
Still failing though - it seems that proper clean up isn't happening for a few tests that get an actual reference to the `window` object. May need to rewrite these tests. Perhaps something to contribute upstream?
"build": "microbundle --target node -f cjs --no-compress src/index.js src/cli.js src/appender.js", | ||
"build": "npm run build:node && npm run build:web", | ||
"build:node": "microbundle --target node -f cjs --no-compress src/index.js src/cli.js src/appender.js", | ||
"build:web": "microbundle -f iife --no-compress --external none --alias jest-message-util=C:\\code\\github\\developit\\karmatic\\src\\lib\\jest\\messageUtilFake.js --define process.env.NODE_ENV=production -i src/lib/jest-globals.js -o dist/lib/jest-globals.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm bundling jest-globals.js
separately at build time to avoid our users having to re-bundle all the jest stuff on each run of karmatic. Probably need to move some of these deps into devDeps
since they are bundled. Or maybe move them to bundledDeps
?
Also need to figure out/fix how to specify aliases in microbundle so that it doesn't require absolute paths
My attempt to include more Jest globals. Sharing to get early feedback though I need to take a break from this for now to focus on other things.
fakeTimers.test.js has two tests failing right now because I think some tests are improperly leaking changed globals between tests.
But I think this PR gets Jest's
fn()
mocking function and fake timers API working!