Skip to content

Commit d110eec

Browse files
test(qwik-nx): update e2e
1 parent a2ed7f5 commit d110eec

File tree

16 files changed

+7492
-2713
lines changed

16 files changed

+7492
-2713
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { names } from '@nx/devkit';
2121
export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
2222
const isPreset = generator === 'preset';
2323
const appPathPrefix = isPreset ? 'apps/' : '';
24-
const libPathPrefix = isPreset ? 'libs/' : '';
24+
const libPathPrefix = '';
2525
const devServerPort = 4212;
2626
const previewServerPort = 4232;
2727
describe(`Basic behavior with ${generator} generator`, () => {
@@ -77,7 +77,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
7777
'should create qwik-nx',
7878
async () => {
7979
const result = await runNxCommandAsync(`build ${project}`);
80-
expect(result.stdout).toContain(
80+
expect(stripConsoleColors(result.stdout)).toContain(
8181
`Running type check for the "${project}"..`
8282
);
8383
expect(
@@ -91,7 +91,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
9191
.join('')
9292
.replace(/\n|\s/g, '')
9393
);
94-
expect(result.stdout).toContain(
94+
expect(stripConsoleColors(result.stdout)).toContain(
9595
`Successfully ran target build for project ${project}`
9696
);
9797
expect(() =>
@@ -167,7 +167,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
167167
'unit tests should pass in the created app',
168168
async () => {
169169
const result = await runNxCommandAsync(`test ${project}`);
170-
expect(result.stdout).toContain(
170+
expect(stripConsoleColors(result.stdout)).toContain(
171171
`Successfully ran target test for project ${project}`
172172
);
173173
},
@@ -186,7 +186,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
186186
const result = await runNxCommandAsync(`test ${project}`, {
187187
silenceError: true,
188188
});
189-
expect(result.stdout).toContain(
189+
expect(stripConsoleColors(result.stdout)).toContain(
190190
`Running target test for project ${project} failed`
191191
);
192192
},
@@ -211,7 +211,7 @@ export function testApplicationBasicBehavior(generator: 'app' | 'preset') {
211211
.join('')
212212
.replace(/\n|\s/g, '')
213213
);
214-
expect(result.stdout).toContain(
214+
expect(stripConsoleColors(result.stdout)).toContain(
215215
`Successfully ran target build for project ${project}`
216216
);
217217
},

e2e/qwik-nx-e2e/tests/chore.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ describe('misc checks', () => {
2323
expect(packageJson.dependencies).toBeUndefined();
2424
expect(packageJson.devDependencies).toBeUndefined();
2525
expect(packageJson.peerDependencies).toEqual({
26-
'@nx/devkit': '^17.0.0 || ^18.0.0 || ^19.0.0',
27-
'@nx/js': '^17.0.0 || ^18.0.0 || ^19.0.0',
28-
'@nx/eslint': '^17.0.0 || ^18.0.0 || ^19.0.0',
29-
'@nx/vite': '^17.0.0 || ^18.0.0 || ^19.0.0',
26+
'@nx/devkit': '^20.0.0',
27+
'@nx/js': '^20.0.0',
28+
'@nx/eslint': '^20.0.0',
29+
'@nx/vite': '^20.0.0',
3030
});
3131
},
3232
DEFAULT_E2E_TIMEOUT

e2e/qwik-nx-e2e/tests/micro-frontends.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('Micro-frontends e2e', () => {
5757
async () => {
5858
const checkProject = async (name: string) => {
5959
const result = await runNxCommandAsync(`build ${name}`);
60-
expect(result.stdout).toContain(
60+
expect(stripConsoleColors(result.stdout)).toContain(
6161
`Successfully ran target build for project ${name}`
6262
);
6363
expect(() =>
@@ -152,7 +152,7 @@ describe('Micro-frontends e2e', () => {
152152
`generate qwik-nx:remote ${remote3} --host=${project} --port=5176 --no-interactive`
153153
);
154154
const result = await runNxCommandAsync(`build ${remote3}`);
155-
expect(result.stdout).toContain(
155+
expect(stripConsoleColors(result.stdout)).toContain(
156156
`Successfully ran target build for project ${remote3}`
157157
);
158158
expect(() =>

e2e/qwik-nx-e2e/tests/qwik-nx-cloudflare.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
killPort,
1212
killPorts,
1313
DEFAULT_E2E_TIMEOUT,
14+
stripConsoleColors,
1415
} from '@qwikifiers/e2e/utils';
1516

1617
const CLOUDFLARE_PREVIEW_PORT = 4173;
@@ -49,7 +50,7 @@ describe('qwik nx cloudflare generator', () => {
4950
'should be able to successfully build the application',
5051
async () => {
5152
const result = await runNxCommandAsync(`build-cloudflare ${project}`);
52-
expect(result.stdout).toContain(
53+
expect(stripConsoleColors(result.stdout)).toContain(
5354
`Successfully ran target build for project ${project}`
5455
);
5556
expect(() =>

e2e/qwik-nx-e2e/tests/qwik-nx-netlify.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
killPort,
1212
killPorts,
1313
DEFAULT_E2E_TIMEOUT,
14+
stripConsoleColors,
1415
} from '@qwikifiers/e2e/utils';
1516

1617
const NETLIFY_PREVIEW_PORT = 8888;
@@ -41,7 +42,7 @@ describe('qwik nx netlify generator', () => {
4142
'should be able to successfully build the application',
4243
async () => {
4344
const result = await runNxCommandAsync(`build-netlify ${project}`);
44-
expect(result.stdout).toContain(
45+
expect(stripConsoleColors(result.stdout)).toContain(
4546
`Successfully ran target build for project ${project}`
4647
);
4748
expect(() =>

e2e/qwik-nx-e2e/tests/qwik-nx-vite.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
removeFile,
1616
killPorts,
1717
DEFAULT_E2E_TIMEOUT,
18+
stripConsoleColors,
1819
} from '@qwikifiers/e2e/utils';
1920

2021
describe('qwikNxVite plugin e2e', () => {
@@ -109,7 +110,7 @@ describe('qwikNxVite plugin e2e', () => {
109110
'should be able to successfully build the application',
110111
async () => {
111112
const result = await runNxCommandAsync(`build ${project}`);
112-
expect(result.stdout).toContain(
113+
expect(stripConsoleColors(result.stdout)).toContain(
113114
`Successfully ran target build for project ${project}`
114115
);
115116
expect(() =>

e2e/qwik-nx-e2e/tests/storybook.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { normalize } from 'path';
1616

1717
const STORYBOOK_PORT = 4400;
1818

19-
describe('qwikNxVite plugin e2e', () => {
19+
xdescribe('qwikNxVite plugin e2e', () => {
2020
beforeAll(async () => {
2121
await killPorts(STORYBOOK_PORT);
2222
ensureNxProject('qwik-nx', 'dist/packages/qwik-nx');
@@ -43,12 +43,13 @@ describe('qwikNxVite plugin e2e', () => {
4343
);
4444
await addAdditionalStories(appProject);
4545
}, DEFAULT_E2E_TIMEOUT);
46+
4647
checkStorybookIsBuiltAndServed(appProject);
4748
});
4849
describe('Applying storybook for existing library', () => {
4950
beforeAll(async () => {
5051
await runNxCommandAsync(
51-
`generate qwik-nx:library ${libProject} --no-interactive`
52+
`generate qwik-nx:library --directory=libs/${libProject} --no-interactive`
5253
);
5354
await runNxCommandAsync(
5455
`generate qwik-nx:storybook-configuration ${libProject} --no-interactive`
@@ -61,7 +62,7 @@ describe('qwikNxVite plugin e2e', () => {
6162
describe('Generating a new library with storybook configuration', () => {
6263
beforeAll(async () => {
6364
await runNxCommandAsync(
64-
`generate qwik-nx:library ${secondLibProject} --storybookConfiguration=true --no-interactive`
65+
`generate qwik-nx:library --directory=libs/${secondLibProject} --storybookConfiguration=true --no-interactive`
6566
);
6667
await addAdditionalStories(secondLibProject);
6768
}, DEFAULT_E2E_TIMEOUT);

e2e/utils/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as treeKill from 'tree-kill';
1010
import {
1111
detectPackageManager,
1212
getPackageManagerCommand,
13+
PackageManager,
1314
} from 'nx/src/utils/package-manager';
1415

1516
export const DEFAULT_E2E_TIMEOUT = 3 * 60 * 1000;
@@ -26,7 +27,7 @@ function getAdditionalPackageManagerCommands(): {
2627
createWorkspace: string;
2728
runNx: string;
2829
} {
29-
const pm = detectPackageManager();
30+
const pm = detectPackageManager() as Exclude<PackageManager, 'bun'>;
3031
const [npmMajorVersion] = execSync(`npm -v`).toString().split('.');
3132
const publishedVersion = execSync('npm view nx version');
3233
switch (pm) {

packages/qwik-nx/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"generators": "./generators.json",
2323
"executors": "./executors.json",
2424
"peerDependencies": {
25-
"@nx/devkit": "^17.0.0 || ^18.0.0 || ^19.0.0",
26-
"@nx/js": "^17.0.0 || ^18.0.0 || ^19.0.0",
27-
"@nx/vite": "^17.0.0 || ^18.0.0 || ^19.0.0",
28-
"@nx/eslint": "^17.0.0 || ^18.0.0 || ^19.0.0"
25+
"@nx/devkit": "^20.0.0",
26+
"@nx/js": "^20.0.0",
27+
"@nx/vite": "^20.0.0",
28+
"@nx/eslint": "^20.0.0"
2929
},
3030
"nx-migrations": {
3131
"migrations": "./migrations.json"

packages/qwik-nx/src/generators/application/files/vite.config.ts__template__

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { qwikNxVite } from 'qwik-nx/plugins';
66

77
export default defineConfig({
88
cacheDir: '<%= offsetFromRoot %>node_modules/.vite/<%= projectRoot %>',
9+
root: '<%= projectRoot %>',
910
plugins: [
1011
qwikNxVite(),
1112
qwikCity(),

0 commit comments

Comments
 (0)