-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Enable and fix babel-register tests #7487
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7076/ |
describe("cache", () => { | ||
let load, get, save; | ||
|
||
beforeEach(() => { | ||
// Since lib/cache is a singleton we need to fully reload it | ||
delete require.cache[require.resolve("../lib/cache")]; | ||
jest.resetModuleRegistry(); |
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.
Isn't this run automatically by jest before each test? (jestjs/jest#587 (comment))
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.
Maybe it changed? Or it is only run once for each test file? At least the tests weren't working without.
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.
Should be jest.resetModules()
. resetModuleRegistry
is a deprecated alias and not publicly documented.
It is not run automatically between tests in a single suite, but each suite (file) is run in isolation
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.
Ah thanks, I somewhere found it documented, but now I can't find it anymore :) Will fix it.
I changed the base register test to mock
pirates and source-map support
and just test it calls these libs correctly.The cache tests worked after fixing the cache invalidation with jest.