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

babel throws when running test suite with ts-jest #9475

Open
paulrehkugler opened this Issue Feb 8, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@paulrehkugler
Copy link

paulrehkugler commented Feb 8, 2019

v7 Regression

Potential Commit/PR that introduced the regression
6d177ba

Describe the regression
Running tests using ts-jest no longer works because this error is thrown:

[BABEL] unknown: Configuration contains string/RegExp pattern, but no filename was passed to Babel

(This issue is also filed in ts-jesthttps://github.com/kulshekhar/ts-jest/issues/934—, but I believe it is a Babel error)

Input Code

Here is a minimal repo that I made that reproduces this issue:
https://github.com/paulrehkugler/ts-jest-babel-no-filename-repro

Babel Configuration (.babelrc, package.json, cli command)

(in repo above)

Expected behavior/code

Previously, the tests ran without crashing. Commenting out throwing the error in Babel also allows the tests to run.

Environment

  • Babel version(s): 7.2.2
  • Node/npm version: node 10.9.0 / npm 6.2.0
  • OS: macOS 10.14.3
  • How you are using Babel: in our testing environment (where this fails), we are using it from ts-jest as a secondary compiler for non-TypeScript files
@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Feb 8, 2019

Hey @paulrehkugler! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@twinser

This comment has been minimized.

Copy link

twinser commented Feb 19, 2019

We came across this bug too, in a slightly different setting.
We were using the following babel config for our Vue app (pretty sure it is the default from the cli):
module.exports = { presets: ["@vue/app"] };
When running jest, we were receiving the Jest encountered an unexpected token error when importing core-js modules. With some searching we discovered #8731 and this answer which suggests we use ignore: [/\/core-js/].

So far so good, the tests started running and most passed. However, one suite would not run. We got the error mentioned in the OP's description and commenting out the lines also makes the test run for us. Interestingly, switching the regex pattern in the babel config for a string also makes the test run.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

nicolo-ribaudo commented Feb 19, 2019

@paulrehkugler In your repo you use babel.config.json, but it isn't a valid configuration file name: it should be babel.config.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment