linux-china / vitest-jetbrains-plugin

Vitest JetBrains plugin
https://plugins.jetbrains.com/plugin/19220-vitest-runner
Apache License 2.0
52 stars 6 forks source link

No test files found #20

Closed Mr-xzq closed 2 years ago

Mr-xzq commented 2 years ago

When add include, cause an exception to trigger:

export default defineConfig({
    test: {
+       // cause an exception to trigger
+       include: ['./playground/**/*.spec.[tj]s'],
        testTimeout: timeout,
        hookTimeout: timeout,
        globals: true,
        reporters: 'dot',
    },
    esbuild: {
        target: 'node14'
    }
})

Error log:

npm exec -- vitest run -t test1 __tests__/auto-script-jsx.spec.js

 RUN  v0.18.1 E:/Desktop/Task/07-cdp-cfe/xzq-vite-plugins/playground/auto-script
-jsx

filter:  __tests__/auto-script-jsx.spec.js
include: ./playground/**/*.spec.[tj]s
exclude:  **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,out
put,temp}/**
watch exclude:  **/node_modules/**, **/dist/**

No test files found, exiting with code 1

More info:

image image image

linux-china commented 2 years ago

For Vitest Runner, the working directory is the package directory, and command line alike following:

$ cd playground
$ npm exec -- vitest run -t test1 __tests__/auto-script-jsx.spec.js

It means different package could have different Vitest configuration because of npm workspaces. You can move vitest.config.js to playground directory, and adjust the configuration and try again.

Mr-xzq commented 2 years ago

Thank you very much for your answer, this solved my problem.