Skip to content

location of results.json when use test.root in vite.config.ts #3272

@tung1404

Description

@tung1404

Describe the bug

Hi,

When I setup vite.config.ts as below, vitest will output the result to root_project\src\node_modules\.vitest\results.json
I think its location is root_project\node_modules\.vitest\results.json

/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
  define: {
    'import.meta.vitest': 'undefined',
  },
  plugins: [react()],
  test: {
    root: 'src',
    globals: true,
    environment: 'happy-dom',
    setupFiles: ['./test-setup.ts'],
    includeSource: ['**/*.{ts,tsx}'],
    mockReset: true,
    restoreMocks: true,
    css: true,
  },
});

Reproduction

{"version":"0.30.1","results":[[":src/App.test.tsx",{"duration":25,"failed":false}]]}

System Info

node 14
npm 6.14

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions