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

Allow skip process method if createTransformer definded #5999

Merged
merged 6 commits into from
Apr 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/jest-runtime/src/script_transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ export default class ScriptTransformer {

// $FlowFixMe
transform = (require(transformPath): Transformer);
if (typeof transform.process !== 'function') {
if (
typeof transform.process !== 'function' &&
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just move this throw below where we invoke createTransformer

typeof transform.createTransformer !== 'function'
) {
throw new TypeError(
'Jest: a transform must export a `process` function.',
'Jest: a transform must export a `process` or `createTransformer` function.',
);
}
if (typeof transform.createTransformer === 'function') {
Expand Down