Skip to content

Commit 58202bf

Browse files
fix(qwik-nx): bump vitest to fix the issue with undefined styles in tests (#130)
1 parent 0a8a8da commit 58202bf

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

e2e/qwik-nx-e2e/tests/application-basic-behavior.suite.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
3636
await runNxCommandAsync(
3737
`generate qwik-nx:${generator} ${projectNameParam} --no-interactive`
3838
);
39+
await runNxCommandAsync(
40+
`generate qwik-nx:component my-test-component --project=${project} --unitTestRunner=vitest --no-interactive`
41+
);
3942
}, DEFAULT_E2E_TIMEOUT);
4043

4144
afterAll(async () => {
@@ -74,6 +77,20 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
7477
DEFAULT_E2E_TIMEOUT
7578
);
7679

80+
it(
81+
'unit tests should pass in the created app',
82+
async () => {
83+
const result = await runNxCommandAsync(`test ${project}`);
84+
expect(result.stdout).toContain(
85+
`Successfully ran target test for project ${project}`
86+
);
87+
expect(stripConsoleColors(result.stdout)).toContain(
88+
`Test Files 1 passed`
89+
);
90+
},
91+
DEFAULT_E2E_TIMEOUT
92+
);
93+
7794
it(
7895
'should run build with a specified configuration',
7996
async () => {
@@ -147,7 +164,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
147164

148165
async function checkPageResponses(host: string) {
149166
// wait for a while to make sure everything is settled
150-
await new Promise(r => setTimeout(r, 3000));
167+
await new Promise((r) => setTimeout(r, 3000));
151168
const domParser = new DOMParser();
152169
const pages = ['', 'flower'];
153170
for (const page of pages) {

packages/qwik-nx/migrations.json

+8
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@
144144
"version": "~2.8.7"
145145
}
146146
}
147+
},
148+
"0.15.4": {
149+
"version": "0.15.4",
150+
"packages": {
151+
"vitest": {
152+
"version": "^0.28.5"
153+
}
154+
}
147155
}
148156
}
149157
}

packages/qwik-nx/src/utils/add-common-qwik-dependencies.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
qwikEslintPluginVersion,
1010
qwikVersion,
1111
undiciVersion,
12+
vitestVersion,
1213
viteTsconfigPathsVersion,
1314
viteVersion,
1415
} from './versions';
@@ -22,17 +23,10 @@ export function addCommonQwikDependencies(host: Tree): GeneratorCallback {
2223
'@builder.io/qwik-city': qwikCityVersion,
2324
'eslint-plugin-qwik': qwikEslintPluginVersion,
2425
vite: viteVersion,
26+
vitest: vitestVersion, // TODO: vitest is also installed by "@nrwl/vite", but our version is higher
2527
'vite-tsconfig-paths': viteTsconfigPathsVersion,
2628
'node-fetch': nodeFetchVersion,
2729
undici: undiciVersion,
28-
// TODO: dependencies below should be setup correctly by Nx's generator, so not needed to provide them here?
29-
// "@types/eslint": typesEslint,
30-
// '@types/node': 'latest',
31-
// "@typescript-eslint/eslint-plugin": tsEslintVersion,
32-
// "@typescript-eslint/parser": tsEslintVersion,
33-
// "eslint": eslintVersion,
34-
// "prettier": prettierVersion,
35-
// "typescript": typescriptVersion,
3630
}
3731
);
3832
}

0 commit comments

Comments
 (0)