Skip to content

Commit d61a19d

Browse files
BioPhotonvmasekhanna-skryl
authored
refactor: use nx-verdaccio for e2e testing (#842)
This PR uses `nx-verdaccio` for all but `cli-e2e` project. In a follow up PR #844 the `e2e-old` target gets refactored and the tooling code gets a cleanup --------- Signed-off-by: Vojtech Masek <vojtech@flowup.cz> Co-authored-by: Vojtech Masek <vojtech@flowup.cz> Co-authored-by: hanna-skryl <hanna.skryl@gmail.com>
1 parent e9560f5 commit d61a19d

File tree

18 files changed

+5278
-3802
lines changed

18 files changed

+5278
-3802
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
- name: Install dependencies
121121
run: npm ci
122122
- name: E2E test affected projects
123-
run: npx nx affected:e2e --parallel=1
123+
run: npx nx affected -t nxv-e2e --exclude cli-e2e --parallel=1
124124
- name: E2E test cli-e2e project (due to bugs in the setup it has to run last :( )
125125
run: npx nx run cli-e2e:e2e-old
126126

e2e/ci-e2e/project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
}
1919
}
2020
},
21-
"implicitDependencies": ["models", "utils", "core", "cli", "ci"],
21+
"implicitDependencies": ["cli", "ci"],
2222
"tags": ["scope:tooling", "type:e2e"]
2323
}

e2e/ci-e2e/vite.config.e2e.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default defineConfig({
1616
},
1717
environment: 'node',
1818
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
globalSetup: ['../../global-setup.verdaccio.ts'],
2019
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
2120
},
2221
});

e2e/create-cli-e2e/vite.config.e2e.ts

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default defineConfig({
1717
},
1818
environment: 'node',
1919
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
20-
globalSetup: ['../../global-setup.verdaccio.ts'],
2120
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
2221
},
2322
});

e2e/nx-plugin-e2e/project.json

+1-8
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@
1818
}
1919
}
2020
},
21-
"implicitDependencies": [
22-
"test-utils",
23-
"models",
24-
"utils",
25-
"core",
26-
"cli",
27-
"nx-plugin"
28-
],
21+
"implicitDependencies": ["test-utils", "nx-plugin"],
2922
"tags": ["scope:tooling", "type:e2e"]
3023
}

e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts

+3-15
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async function addTargetToWorkspace(
4747
codeStrings: 'customPlugin()',
4848
},
4949
],
50+
// The upload test is skipped as it requires the @code-pushup/portal-client dependency
5051
upload: {
5152
server: 'https://dummy-server.dev',
5253
organization: 'dummy-organization',
@@ -108,8 +109,8 @@ describe('executor command', () => {
108109
await addTargetToWorkspace(tree, { cwd, project });
109110

110111
const { stdout, code } = await executeProcess({
111-
command: 'nx',
112-
args: ['run', `${project}:code-pushup`, 'collect'],
112+
command: 'npx',
113+
args: ['nx', 'run', `${project}:code-pushup`, 'collect'],
113114
cwd,
114115
});
115116

@@ -136,17 +137,4 @@ describe('executor command', () => {
136137
}),
137138
);
138139
});
139-
140-
it('should execute upload executor to throw if no report is present', async () => {
141-
const cwd = join(baseDir, 'execute-upload-command');
142-
await addTargetToWorkspace(tree, { cwd, project });
143-
144-
await expect(
145-
executeProcess({
146-
command: 'npx',
147-
args: ['nx', 'run', `${project}:code-pushup`, 'upload'],
148-
cwd,
149-
}),
150-
).rejects.toThrow(/report.json/);
151-
});
152140
});

e2e/nx-plugin-e2e/vite.config.e2e.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default defineConfig({
1616
},
1717
environment: 'node',
1818
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
globalSetup: ['../../global-setup.verdaccio.ts'],
2019
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
2120
},
2221
});

e2e/plugin-lighthouse-e2e/project.json

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
}
1919
}
2020
},
21-
"implicitDependencies": [
22-
"models",
23-
"utils",
24-
"core",
25-
"cli",
26-
"plugin-lighthouse"
27-
],
21+
"implicitDependencies": ["cli", "plugin-lighthouse"],
2822
"tags": ["scope:plugin", "type:e2e"]
2923
}

e2e/plugin-lighthouse-e2e/vite.config.e2e.ts

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default defineConfig({
1616
},
1717
environment: 'node',
1818
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
globalSetup: ['../../global-setup.verdaccio.ts'],
2019
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
2120
},
2221
});

nx.json

+12
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@
111111
"releaseTagPattern": "v{version}"
112112
},
113113
"plugins": [
114+
{
115+
"plugin": "@push-based/nx-verdaccio",
116+
"options": {
117+
"environments": {
118+
"environmentsDir": "tmp/e2e",
119+
"targetNames": ["e2e"]
120+
},
121+
"packages": {
122+
"filterByTags": ["publishable"]
123+
}
124+
}
125+
},
114126
"./tools/src/debug/debug.plugin.ts",
115127
{
116128
"plugin": "./tools/src/npm/npm.plugin.ts",

0 commit comments

Comments
 (0)