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

Correctly bundle up for browser globals #7661

Merged
merged 2 commits into from
Jan 20, 2019
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 20, 2019

Summary

Fixes #7109.

I decided to go for webpack, since I know it better than I do browserify. Rollup only works with ESM, and migrating to that is hard.

It also seemed unnecessary to have 2 different bundlers

Test plan

Green CI. I've also tested with an html file, and expect is available.

<!DOCTYPE html>
<html>
  <head>
    <script src="/node_modules/expect/build-es5/index.js"></script>
  </head>
  <body>
    <script>
      expect(1).toBe(2);
    </script>
  </body>
</html>

image

Note: If we could find some browser version of chalk, that would be awesome

},
},
node: {
fs: 'empty',
Copy link
Member Author

@SimenB SimenB Jan 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

both jest-message-util and micromatch (a dependency of jest-message-util) uses fs, but work without it

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit

@thymikee
Copy link
Collaborator

Looks like e2e/__tests__/overrideGlobals.test.js may be more permissive in terms of output

@SimenB
Copy link
Member Author

SimenB commented Jan 20, 2019

Not really, it needs to test that the timing in parens is there. Maybe try to make it even slower?

@SimenB SimenB merged commit 6880611 into jestjs:master Jan 20, 2019
@SimenB SimenB deleted the use-webpack branch January 20, 2019 20:47
@thymikee
Copy link
Collaborator

Pardon, I just assumed that without checking. Then yes, we should fix the flakyness

captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
* use webpack over browserify for browser test

* use webpack over rollup for browser build
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expect NPM package unusable in browser
3 participants