nx icon indicating copy to clipboard operation
nx copied to clipboard

Nx+Vitest ignores root vitest.config.ts

Open Lonli-Lokli opened this issue 1 year ago โ€ข 2 comments
trafficstars

Current Behavior

Any settings specified in root vitest.config.ts are ignored

Expected Behavior

Settings from root vitest.config.ts should be applied

GitHub Repo

No response

Steps to Reproduce

  1. Create any Nx + Vitest repo
  2. Remove existing test
  3. Add root vitest.config.ts with
import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    passWithNotTests: true
  }
})
  1. Run npx nx proj:test

Nx Report

NX   Report complete - copy this into the issue template

Node   : 18.18.2
OS     : win32-x64
npm    : 9.8.1

nx                 : 19.0.2
@nx/js             : 19.0.2
@nx/linter         : 19.0.2
@nx/eslint         : 19.0.2
@nx/workspace      : 19.0.2
@nx/devkit         : 19.0.2
@nx/eslint-plugin  : 19.0.2
@nx/react          : 19.0.2
@nrwl/tao          : 19.0.2
@nx/vite           : 19.0.2
@nx/web            : 19.0.2
typescript         : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

  • [ ] macOS
  • [ ] Linux
  • [X] Windows
  • [ ] Other (Please specify)

Additional Information

No response

Lonli-Lokli avatar May 10 '24 13:05 Lonli-Lokli

Hey, can you provide a repro so we can investigate, this is working as expected on my end.

ndcunningham avatar May 16 '24 19:05 ndcunningham

@ndcunningham Here is it https://github.com/Lonli-Lokli/issues-nrwl-nx-23303

Lonli-Lokli avatar May 17 '24 11:05 Lonli-Lokli

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar May 25 '24 00:05 github-actions[bot]

It's not stale! @AgentEnder

Lonli-Lokli avatar May 25 '24 05:05 Lonli-Lokli

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Jun 02 '24 00:06 github-actions[bot]

It's active but ignored

Lonli-Lokli avatar Jun 02 '24 05:06 Lonli-Lokli

@ndcunningham could you reproduce the issue?

Lonli-Lokli avatar Jun 09 '24 00:06 Lonli-Lokli

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Jun 16 '24 00:06 github-actions[bot]

Not stale

Lonli-Lokli avatar Jun 16 '24 04:06 Lonli-Lokli

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™

github-actions[bot] avatar Jun 24 '24 00:06 github-actions[bot]

Reproduction provided, not stalw

Lonli-Lokli avatar Jun 24 '24 05:06 Lonli-Lokli

I don't see the issue?

If I run npx vitest in apps/nx-vitest, it fails on no test files found. Vitest itself is not finding your root config file.

If you look at the test target for your app (via nx show project nx-vitest) you'll see the cwd is set to apps/nx-vitest.

What you can do is run nx test which will pick up your root vitest.workspace.ts file, which in turn finds your root vitest.config.ts file.

Everything here is working as expected.

Coly010 avatar Jun 28 '24 16:06 Coly010

@Coly010 That's actually a continuation of my previous issue https://github.com/nrwl/nx/issues/22139#issuecomment-2031864054

What I want is to have an ability to setup something global for tests, and to allow Nx+Vitest pick up this workspace file, which does not happen.

What I do not want is to specify passWithNoTst or any global options like coverage reporters in each {project}/vitest.config.ts

Lonli-Lokli avatar Jun 28 '24 16:06 Lonli-Lokli

In that case it would be better to create a feature request over on the discussions: https://github.com/nrwl/nx/discussions/new?category=feature-requests

Coly010 avatar Jun 28 '24 17:06 Coly010

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Jul 29 '24 00:07 github-actions[bot]