Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

jest: Use babel-jest instead of a custom implementation #1183

Merged
merged 1 commit into from
Oct 21, 2018
Merged

jest: Use babel-jest instead of a custom implementation #1183

merged 1 commit into from
Oct 21, 2018

Conversation

edmorley
Copy link
Member

We were previously just reimplementing parts of it, and not using the latest recommended Babel settings (such as still setting retainLines: true when sourcemaps are supported natively).

There isn't currently a way to set the babel-jest createTransformer() options via Jest configuration/globals, so we instead have to resort to using an environment variable. This has the limitation of only supporting Babel options that are serializable (virtually all commonly used configuration options are), with any others being silently omitted. However this was already the case when using globals anyway.

See:
https://github.com/facebook/jest/blob/v23.6.0/packages/babel-jest/README.md
https://github.com/facebook/jest/blob/v23.6.0/packages/babel-jest/src/index.js

Fixes #851.

We were previously just reimplementing parts of it, and not using
the latest recommended Babel settings (such as still setting
`retainLines: true` when sourcemaps are supported natively).

There isn't currently a way to set the babel-jest `createTransformer()`
options via Jest configuration/globals, so we instead have to resort
to using an environment variable. This has the limitation of only
supporting Babel options that are serializable (virtually all commonly
used configuration options are), with any others being silently omitted.
However this was already the case when using `globals` anyway.

See:
https://github.com/facebook/jest/blob/v23.6.0/packages/babel-jest/README.md
https://github.com/facebook/jest/blob/v23.6.0/packages/babel-jest/src/index.js

Fixes #851.
@edmorley edmorley added this to the v9 milestone Oct 20, 2018
@edmorley edmorley self-assigned this Oct 20, 2018
Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

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

Very nice!

@edmorley edmorley merged commit ff30cd6 into neutrinojs:master Oct 21, 2018
@edmorley edmorley deleted the use-babel-jest branch October 21, 2018 21:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants