vuejs / vue-jest

Jest Vue transformer
MIT License
748 stars 156 forks source link

`Not found tsconfig.json` warning in log #490

Closed Theiaz closed 2 years ago

Theiaz commented 2 years ago

Using vue-jest within a project which is not using typescript / tsconfig.json leads to randomly appearing warning inside my #log:

> jest ./src/test/js

 PASS  src/test/js/ComponentA.test.js

[vue-jest]: Not found tsconfig.json.
...

I'm not able to reproduce it. However, I observed that this is appearing if running my testsuite for the first time. Running it again does not show this warning.

First run:

> jest --coverage ./src/test/js

 PASS  src/test/js/ComponentA.test.js

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

 PASS  src/test/js/ComponentB.test.js (5.661 s)
 PASS  src/test/js/ComponentC.test.js(5.781 s)

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

[vue-jest]: Not found tsconfig.json.

Second run:

> jest --coverage ./src/test/js

 PASS  src/test/js/ComponentA.test.js
 PASS  src/test/js/ComponentB.test.js (5.661 s)
 PASS  src/test/js/ComponentC.test.js(5.781 s)

The following line is causing the problem which has been introduced with https://github.com/vuejs/vue-jest/pull/471 https://github.com/vuejs/vue-jest/blob/6d1eec51c40d4c221a6a2b16c8bf7e5798b2a403/packages/vue3-jest/lib/utils.js#L79

Is this a problem with my config or should the warning not be displayed?

nogic1008 commented 2 years ago

@Theiaz In vue3-jest, getTypeScriptConfig calls every times whether project uses TypeScript or not. I'll make a PR to fix it. https://github.com/vuejs/vue-jest/blob/6d1eec51c40d4c221a6a2b16c8bf7e5798b2a403/packages/vue3-jest/lib/process.js#L121

Theiaz commented 2 years ago

@nogic1008 Thanks!