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

setupFiles do not transform by babel-jest #9041

Closed
MrGaoGang opened this issue Oct 11, 2019 · 7 comments
Closed

setupFiles do not transform by babel-jest #9041

MrGaoGang opened this issue Oct 11, 2019 · 7 comments

Comments

@MrGaoGang
Copy link

🐛 Bug Report

To Reproduce

when i config in jest.config.js, i set setupFiles is ["<rootDir>/test/setup"]
such as:

module.exports = {
  setupFiles: ["<rootDir>/test/setup"],
  moduleFileExtensions: ["js", "vue", "jsx", "json"],
  ...
}

but i see the setup.js do not transfer by es6, so i can't use 'import'

@wldcordeiro
Copy link

Yeah I had to add my file to transformIgnorePatterns which felt weird to me. 🤷‍♂

@kylealwyn
Copy link

This seems like a potential regression. After bumping from 24.8.0 to 24.9.0, I began receiving the following error:

/Users/kyle/dev/stax/api/db/migrations/20180128104235_initial.ts:1
import Knex from 'knex';
       ^^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:872:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at FsMigrations.getMigration (/Users/kyle/dev/stax/api/node_modules/knex/src/migrate/sources/fs-migrations.js:84:12)
    at /Users/kyle/dev/stax/api/node_modules/knex/src/migrate/Migrator.js:82:69
    at arrayFilter (/Users/kyle/dev/stax/api/node_modules/lodash/lodash.js:582:11)
    at filter (/Users/kyle/dev/stax/api/node_modules/lodash/lodash.js:9175:14)
    at /Users/kyle/dev/stax/api/node_modules/knex/src/migrate/Migrator.js:81:13
...

Downgrading back to 24.8.0 removes the issue. Trying to get a small reproduction together.

@mikestopcontinues
Copy link

No fix yet?

@dmasterstempus
Copy link

For me, 24.8.0 also doesn't work. The latest version to work is 24.1.0.

Related: #5164

@SimenB
Copy link
Member

SimenB commented Jan 14, 2020

No reproduction has been provided, the parts asking for it in the template was just deleted.

Please provide a minimal reproduction when opening issues

@SimenB SimenB closed this as completed Jan 14, 2020
@eranimo
Copy link
Contributor

eranimo commented Mar 31, 2021

This is still an issue

@github-actions
Copy link

This issue 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 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants