Open nstuyvesant opened 4 years ago
ts-jest's options babelConfig
is true
, then ts-jest@24
tries to load babelConfig, but it doesn't have the ability to load the config in package.json. Then, babel-jest
can't get the @vue/cli-plugin-babel/preset
.
ts-jest@25/26
rewrite some codes and don't have this problem. Updating ts-jest can solve it. (yarn resolutions, also needs to update jest, babel-jest, etc)
@nstuyvesant, is there a chance you are/were using some form of package workspaces (like yarn)? I'm running in the same thing from what I can see in
It passes in possible config files as babel.config.js and .browserslistrc. And then in
It appends yarn.lock and package-lock.json. It won't look at package.json itself. In a workspace environment, the tools won't create the package-lock.json or yarn.lock in each workspace project, only at the root so I don't think it will pick up the config in this case.
Unfortunate as I'd love to remove some of the 2-3 line config files from each workspace project.
This was looking at v4.5.9
Version
4.4.6
Reproduction link
https://github.com/nstuyvesant/shy3/blob/master/package.json
Environment info
Steps to reproduce
See babel configuration in this package.json. If there is no babel.config.js file in my top directory, running unit tests fails because they were written in TypeScript.
$ vue create testapp (select TypeScript w/Babel and unit and e2e testing) $ cd testapp
add this to package.json "babel": { "presets": [ "@vue/cli-plugin-babel/preset" ] },
delete babel.config.js. $ npm run test:unit
What is expected?
Example unit test runs successfully
What is actually happening?
$ vue-cli-service test:unit --no-cache FAIL tests/unit/example.spec.ts ● Test suite failed to run
Per https://babeljs.io/docs/en/configuration, we should be able to have babel configuration in the package.json. It just doesn't work.