vuejs / vue-jest

Jest Vue transformer
MIT License
746 stars 157 forks source link

vue-jest won't compile unless tsconfig.json has "compilerOptions" #386

Open william-will-angi opened 3 years ago

william-will-angi commented 3 years ago

I saw this issue which is relevant, but not the exact same: https://github.com/vuejs/vue-jest/issues/118

My tsconfig:

{
  "extends": "../../tsconfig.json"
}

Build output:

FAIL test/index.spec.js
  ● Test suite failed to run

    TypeError: Cannot read property 'module' of undefined

      at compileTypescript (../../node_modules/vue-jest/lib/compilers/typescript-compiler.js:19:32)
      at processScript (../../node_modules/vue-jest/lib/process.js:23:12)
      at Object.module.exports [as process] (../../node_modules/vue-jest/lib/process.js:42:18)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        2.085 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @myorg/my-component@0.0.1 test:unit: `NODE_ENV=test jest --config ../../jest.config.js`

Changing my tsconfig to the following fixes the issue:

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {}
}