Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@nx/vite:test does not find tests with custom vitest config #19076

Closed
1 of 4 tasks
NicoVogel opened this issue Sep 8, 2023 · 2 comments
Closed
1 of 4 tasks

@nx/vite:test does not find tests with custom vitest config #19076

NicoVogel opened this issue Sep 8, 2023 · 2 comments
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx stale type: bug

Comments

@NicoVogel
Copy link

Current Behavior

@nx/vite:test (version 16.7.1) does not find test suite.

Expected Behavior

I expect it to find the tests.
It does work if I navigate into the directory and use pnpm vitest -c vitest.node.ts

GitHub Repo

https://github.com/NicoVogel/logger-wrapper

Steps to Reproduce

  1. clone repo
  2. checkout bug/nx-vite-test-no-tests-found
  3. (optional) reopen project in dev container
  4. pnpm install
  5. pnpm exec nx test logger

Nx Report

Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 >  NX   Report complete - copy this into the issue template

   Node   : 20.5.0
   OS     : linux-x64
   pnpm   : 8.6.12
   
   nx                 : 16.7.1
   @nx/js             : 16.7.1
   @nx/linter         : 16.7.1
   @nx/workspace      : 16.7.1
   @nx/devkit         : 16.7.1
   @nx/eslint-plugin  : 16.7.1
   @nrwl/tao          : 16.7.1
   @nx/vite           : 16.7.1
   typescript         : 5.1.6

Failure Logs

nx run logger:test-node

 RUN  v0.34.4 /workspaces/logger-wrapper/packages/logger
 ❯ src/node/logger.spec.ts  (0 test) 3ms
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
 FAIL  src/node/logger.spec.ts [ src/node/logger.spec.ts ]
Error: No test found in suite src/node/logger.spec.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
 Test Files  1 failed (1)
      Tests  no tests
   Start at  13:22:55
   Duration  668ms (transform 113ms, setup 0ms, collect 80ms, tests 3ms, environment 0ms, prepare 145ms)

 ————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target test for project logger and 1 task(s) they depend on (2s)
 
    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Package Manager Version

pnpm 8.6.12

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The general intended setup is to test the library logger in both the browser and node environment.
Therefore there are multiple vite config files.

But relevant for this bug is that it only happens with the @nx/vite:test executor, as it works fine when doing the following:

  1. cd packages/logger
  2. pnpm vitest -c vitest.node.ts
@FrozenPandaz FrozenPandaz added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Sep 8, 2023
Copy link

github-actions bot commented Mar 7, 2024

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx stale type: bug
Projects
None yet
Development

No branches or pull requests

2 participants