Skip to content
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

Merged
merged 1 commit into from Mar 5, 2018
Merged

Enable and fix babel-register tests #7487

merged 1 commit into from Mar 5, 2018

Conversation

@danez
Copy link
Member

danez commented Mar 4, 2018

Q                       A
Fixed Issues? Fixes #7477
Patch: Bug Fix? n
Major: Breaking Change? n
Minor: New Feature? n
Tests Added + Pass? Yes
Documentation PR
Any Dependency Changes?
License MIT

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.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Mar 4, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/7076/

@danez danez force-pushed the register-tests branch from b82010a to b27ce67 Mar 4, 2018
@danez danez force-pushed the register-tests branch from b27ce67 to b8c4551 Mar 4, 2018
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();

This comment has been minimized.

Copy link
@nicolo-ribaudo

nicolo-ribaudo Mar 5, 2018

Member

Isn't this run automatically by jest before each test? (facebook/jest#587 (comment))

This comment has been minimized.

Copy link
@danez

danez Mar 5, 2018

Author Member

Maybe it changed? Or it is only run once for each test file? At least the tests weren't working without.

This comment has been minimized.

Copy link
@SimenB

SimenB Mar 5, 2018

Contributor

Should be jest.resetModules(). resetModuleRegistry is a deprecated alias and not publicly documented.

See https://github.com/facebook/jest/blob/0b076cdfd6020810fc05fb0f26cdca30d688ead1/packages/jest-runtime/src/index.js#L830-L831

It is not run automatically between tests in a single suite, but each suite (file) is run in isolation

This comment has been minimized.

Copy link
@danez

danez Mar 5, 2018

Author Member

Ah thanks, I somewhere found it documented, but now I can't find it anymore :) Will fix it.

@danez danez merged commit f43bf7f into master Mar 5, 2018
5 checks passed
5 checks passed
babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 84.84% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@danez danez deleted the register-tests branch Mar 5, 2018
aminmarashi-binary added a commit to aminmarashi-binary/babel that referenced this pull request Mar 17, 2018
@lock lock bot added the outdated label Oct 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants
You can’t perform that action at this time.