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

Expose Jest transform function to help with Jest-Babel-Webpack compatibility #214

Closed
davidtheclark opened this issue Mar 4, 2018 · 0 comments

Comments

@davidtheclark
Copy link
Contributor

davidtheclark commented Mar 4, 2018

There are a few annoying things about running Jest within codebases that use Webpack generally, Batfish specifically.

  • Babel config is created behind the scenes for Webpack, combining Batfish defaults with user options (babelPlugins, babelPresets). Jest doesn't know about this; so if you want to write Jest tests for files that rely on this Batfish-generated Babel config, you have to reproduce it in a .babelrc file or something else Jest can read.
  • Batfish allows Webpack to allow you to import non-JS files. Jest doesn't run Webpack so it will break on non-JS imports. You need to configure Jest to ignore those.

To deal with this, I think Batfish should export a jest-transform function that can be passed to Jest's transform config option, and it will try to take care of whatever transforms Jest needs to work with Webpack things.

cf. jestjs/jest#1468 (comment), https://github.com/atecarlos/webpack-babel-jest/blob/master/index.js

davidtheclark pushed a commit that referenced this issue Mar 6, 2018
Closes #214 by facilitating Babel-config sharing with test runners.

Closes #224 by allowing absolute paths for babelPlugins and
babelPresets. Those are now the expected format; functions are
deprecated.
davidtheclark pushed a commit that referenced this issue Mar 6, 2018
Closes #214 by facilitating Babel-config sharing with test runners.

Closes #224 by allowing absolute paths for babelPlugins and
babelPresets. Those are now the expected format; functions are
deprecated.
davidtheclark pushed a commit that referenced this issue Mar 6, 2018
Closes #214 by facilitating Babel-config sharing with test runners.

Closes #224 by allowing absolute paths for babelPlugins and
babelPresets. Those are now the expected format; functions are
deprecated.
davidtheclark added a commit that referenced this issue Mar 6, 2018
Closes #214 by facilitating Babel-config sharing with test runners.

Closes #224 by allowing absolute paths for babelPlugins and
babelPresets. Those are now the expected format; functions are
deprecated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant