Skip to content

Commit

Permalink
refactor: use nx-verdaccio for e2e testing (#842)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: Vojtech Masek <[email protected]>
Co-authored-by: hanna-skryl <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent e9560f5 commit d61a19d
Show file tree
Hide file tree
Showing 18 changed files with 5,278 additions and 3,802 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: E2E test affected projects
run: npx nx affected:e2e --parallel=1
run: npx nx affected -t nxv-e2e --exclude cli-e2e --parallel=1
- name: E2E test cli-e2e project (due to bugs in the setup it has to run last :( )
run: npx nx run cli-e2e:e2e-old

Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
}
}
},
"implicitDependencies": ["models", "utils", "core", "cli", "ci"],
"implicitDependencies": ["cli", "ci"],
"tags": ["scope:tooling", "type:e2e"]
}
1 change: 0 additions & 1 deletion e2e/ci-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default defineConfig({
},
environment: 'node',
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['../../global-setup.verdaccio.ts'],
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
},
});
1 change: 0 additions & 1 deletion e2e/create-cli-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default defineConfig({
},
environment: 'node',
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['../../global-setup.verdaccio.ts'],
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
},
});
9 changes: 1 addition & 8 deletions e2e/nx-plugin-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
}
}
},
"implicitDependencies": [
"test-utils",
"models",
"utils",
"core",
"cli",
"nx-plugin"
],
"implicitDependencies": ["test-utils", "nx-plugin"],
"tags": ["scope:tooling", "type:e2e"]
}
18 changes: 3 additions & 15 deletions e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function addTargetToWorkspace(
codeStrings: 'customPlugin()',
},
],
// The upload test is skipped as it requires the @code-pushup/portal-client dependency
upload: {
server: 'https://dummy-server.dev',
organization: 'dummy-organization',
Expand Down Expand Up @@ -108,8 +109,8 @@ describe('executor command', () => {
await addTargetToWorkspace(tree, { cwd, project });

const { stdout, code } = await executeProcess({
command: 'nx',
args: ['run', `${project}:code-pushup`, 'collect'],
command: 'npx',
args: ['nx', 'run', `${project}:code-pushup`, 'collect'],
cwd,
});

Expand All @@ -136,17 +137,4 @@ describe('executor command', () => {
}),
);
});

it('should execute upload executor to throw if no report is present', async () => {
const cwd = join(baseDir, 'execute-upload-command');
await addTargetToWorkspace(tree, { cwd, project });

await expect(
executeProcess({
command: 'npx',
args: ['nx', 'run', `${project}:code-pushup`, 'upload'],
cwd,
}),
).rejects.toThrow(/report.json/);
});
});
1 change: 0 additions & 1 deletion e2e/nx-plugin-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default defineConfig({
},
environment: 'node',
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['../../global-setup.verdaccio.ts'],
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
},
});
8 changes: 1 addition & 7 deletions e2e/plugin-lighthouse-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
}
}
},
"implicitDependencies": [
"models",
"utils",
"core",
"cli",
"plugin-lighthouse"
],
"implicitDependencies": ["cli", "plugin-lighthouse"],
"tags": ["scope:plugin", "type:e2e"]
}
1 change: 0 additions & 1 deletion e2e/plugin-lighthouse-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default defineConfig({
},
environment: 'node',
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
globalSetup: ['../../global-setup.verdaccio.ts'],
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
},
});
12 changes: 12 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@
"releaseTagPattern": "v{version}"
},
"plugins": [
{
"plugin": "@push-based/nx-verdaccio",
"options": {
"environments": {
"environmentsDir": "tmp/e2e",
"targetNames": ["e2e"]
},
"packages": {
"filterByTags": ["publishable"]
}
}
},
"./tools/src/debug/debug.plugin.ts",
{
"plugin": "./tools/src/npm/npm.plugin.ts",
Expand Down
Loading

0 comments on commit d61a19d

Please sign in to comment.