Description
Current Behavior
Hello. I just create new workspace for angular with vitests. ( I try to do it for about few hours with different setrtings and no way.)
Here is copy of console:
npx create-nx-workspace@latest --a
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
√ Where would you like to create your workspace? · org
√ Which stack do you want to use? · angular
√ Integrated monorepo, or standalone project? · integrated
√ Application name · my-app
√ Which bundler would you like to use? · esbuild
√ Default stylesheet format · scss
√ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? · No
√ Which unit test runner would you like to use? · vitest
√ Test runner to use for end to end (E2E) tests · playwright
√ Which package manager to use · npm
√ Main branch name · main
√ Which CI provider would you like to use? · skip
√ Would you like remote caching to make your build faster? · skip
NX Creating your v20.8.1 workspace.
√ Installing dependencies with npm
√ Successfully created the workspace: org.
NX Welcome to the Nx community! 👋
🌟 Star Nx on GitHub: https://github.com/nrwl/nx
📢 Stay up to date on X: https://x.com/nxdevtools
💬 Discuss Nx on Discord: https://go.nx.dev/community
C:>cd org\
C:\org>nx test my-app
nx run my-app:test
RUN v3.1.2 C:/org/apps/my-app
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/app/app.component.spec.ts [ src/app/app.component.spec.ts ]
Error: NG0401: No platform exists!
❯ assertPlatform ../../../../packages/core/src/platform/platform.ts:119:11
❯ ../../../../packages/core/src/platform/platform.ts:91:12
❯ src/test-setup.ts:11:3
9| getTestBed().initTestEnvironment(
10| BrowserDynamicTestingModule,
11| platformBrowserDynamicTesting()
| ^
12| );
13|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests no tests
Start at 00:08:47
Duration 1.13s (transform 121ms, setup 0ms, collect 0ms, tests 0ms, environment 451ms, prepare 561ms)
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target test for project my-app (3s)
× 1/1 failed
√ 0/1 succeeded [0 read from cache]
As you can see, just after finished i just change dir and run tests, and it fail.
Thanx.
Expected Behavior
it should just work.
GitHub Repo
No response
Steps to Reproduce
1: npx create-nx-workspace@latest --a
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
√ Where would you like to create your workspace? · org
√ Which stack do you want to use? · angular
√ Integrated monorepo, or standalone project? · integrated
√ Application name · my-app
√ Which bundler would you like to use? · esbuild
√ Default stylesheet format · scss
√ Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)? · No
√ Which unit test runner would you like to use? · vitest
√ Test runner to use for end to end (E2E) tests · playwright
√ Which package manager to use · npm
√ Main branch name · main
√ Which CI provider would you like to use? · skip
√ Would you like remote caching to make your build faster? · skip
2: cd org
3: nx test my-app
Nx Report
Node : 22.14.0
OS : win32-x64
Native Target : x86_64-windows
npm : 10.9.2
nx (global) : 20.5.0
nx : 20.8.1
@nx/js : 20.8.1
@nx/eslint : 20.8.1
@nx/workspace : 20.8.1
@nx/angular : 20.8.1
@nx/devkit : 20.8.1
@nx/eslint-plugin : 20.8.1
@nx/module-federation : 20.8.1
@nx/playwright : 20.8.1
@nx/rspack : 20.8.1
@nx/vite : 20.8.1
@nx/web : 20.8.1
@nx/webpack : 20.8.1
typescript : 5.7.3
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@analogjs/vite-plugin-angular : 1.14.1
@analogjs/vitest-angular : 1.14.1
angular-eslint : 19.3.0
---------------------------------------
Cache Usage: 0.00 B / 186.15 GB
Failure Logs
nx run my-app:test
RUN v3.1.2 C:/org/apps/my-app
⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL src/app/app.component.spec.ts [ src/app/app.component.spec.ts ]
Error: NG0401: No platform exists!
❯ assertPlatform ../../../../packages/core/src/platform/platform.ts:119:11
❯ ../../../../packages/core/src/platform/platform.ts:91:12
❯ src/test-setup.ts:11:3
9| getTestBed().initTestEnvironment(
10| BrowserDynamicTestingModule,
11| platformBrowserDynamicTesting()
| ^
12| );
13|
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests no tests
Start at 00:08:47
Duration 1.13s (transform 121ms, setup 0ms, collect 0ms, tests 0ms, environment 451ms, prepare 561ms)
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target test for project my-app (3s)
× 1/1 failed
√ 0/1 succeeded [0 read from cache]
Package Manager Version
npm
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response