You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to update the test results output directory by updating the test.outputFile attribute in my vite.config.js file. but instead of changing where the results file is created, it seems to just create a second results file at the specified location.
The default setting seems to be to create the results file in the node_modules directory, and I'm using Yarn PnP on this project. Since node_modules doesn't exist with Yarn PnP, it's annoying that vitest keeps adding one to my project. This unfortunately also seems to confuse some of my plugins, which then start expecting dependencies to be installed in the node_modules directory since it exists.
My vite.config.js is below.
import{defineConfig}from'vitest/config';constlibraryName="library";exportdefaultdefineConfig({build: {lib: {entry: "lib/main.ts",// Your library's entry pointname: libraryName,// Global variable name for UMD buildsfileName: (format)=>`${libraryName}.${format}.js`,},outDir: 'dist',},test: {coverage: {provider: "v8",// or 'istanbul'include: ["lib/**/*.ts"],reporter: ['text'],},reporters: ["json"],outputFile: './my-custom-results-dir/results.json'},});
I'm not trying to update the location of the cache directory, .vitest is just what I decided to name the new directory I wanted to store my test results in (it could've been named anything). Perhaps I should've picked a different name if .vitest is already being used for storing the cache
I think you are confused about the purpose of node_modules/.vite/vitest/results.json. That's not our json reporter output, but it's our test cache file. In order to change the location of cache file, you can use cacheDir. The one in outputFile is the actual user facing json reporter output.
Describe the bug
I'm attempting to update the test results output directory by updating the
test.outputFile
attribute in myvite.config.js
file. but instead of changing where the results file is created, it seems to just create a second results file at the specified location.The default setting seems to be to create the results file in the
node_modules
directory, and I'm using Yarn PnP on this project. Sincenode_modules
doesn't exist with Yarn PnP, it's annoying that vitest keeps adding one to my project. This unfortunately also seems to confuse some of my plugins, which then start expecting dependencies to be installed in thenode_modules
directory since it exists.My
vite.config.js
is below.Reproduction
yarn install
yarn test
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: