Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor old tests and cleanup test helpers #873

Merged
merged 86 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
bd1b8e1
cherry-pick
BioPhoton Nov 9, 2024
d92bf46
adjust target name
BioPhoton Nov 9, 2024
8cc75ee
test: add eslint e2e project
BioPhoton Nov 9, 2024
71ff81a
test: add eslint e2e env project
BioPhoton Nov 9, 2024
7718c06
wip
BioPhoton Nov 9, 2024
a0ef58e
wip
BioPhoton Nov 9, 2024
ba625bb
wip
BioPhoton Nov 9, 2024
3060275
wip
BioPhoton Nov 9, 2024
d4b84ad
wip
BioPhoton Nov 9, 2024
edaa857
use minimal eslint rules
BioPhoton Nov 9, 2024
efd1b07
wip
BioPhoton Nov 9, 2024
f4253d0
wip
BioPhoton Nov 9, 2024
f9911fb
wip
BioPhoton Nov 9, 2024
5f0dfbe
reduce configuration
BioPhoton Nov 9, 2024
14ad3c0
wip
BioPhoton Nov 9, 2024
83bdb98
update nx-verdaccio to alpha.26
BioPhoton Nov 9, 2024
7dad5b5
test: split coverage tests
BioPhoton Nov 9, 2024
e8cba86
config
BioPhoton Nov 9, 2024
436673f
remove duplicate test
BioPhoton Nov 9, 2024
69eba25
polish
BioPhoton Nov 9, 2024
ff44111
polish
BioPhoton Nov 9, 2024
9ddce4d
remove duplicate CP runs
BioPhoton Nov 9, 2024
3239423
add test script
BioPhoton Nov 9, 2024
3ad8ee4
verbose gh action
BioPhoton Nov 9, 2024
a624b5a
adjust tests
BioPhoton Nov 10, 2024
7811490
adjust react example setup
BioPhoton Nov 10, 2024
de6d0ec
wip
BioPhoton Nov 10, 2024
1e943b7
wip plugin
BioPhoton Nov 10, 2024
d774356
wip plugin
BioPhoton Nov 10, 2024
0735e7f
wip env
BioPhoton Nov 10, 2024
1e297ef
wip test
BioPhoton Nov 10, 2024
2d5e51e
wip test
BioPhoton Nov 10, 2024
9751e92
wip test
BioPhoton Nov 10, 2024
e87e5ef
wip test
BioPhoton Nov 10, 2024
75a112e
wip env
BioPhoton Nov 10, 2024
ce74064
wip env
BioPhoton Nov 10, 2024
9c2619d
wip env
BioPhoton Nov 10, 2024
89de2ca
wip env
BioPhoton Nov 10, 2024
5f2fbb0
wip env
BioPhoton Nov 10, 2024
f39c5b6
wip env
BioPhoton Nov 10, 2024
7abcae7
format
BioPhoton Nov 10, 2024
9923b53
cleanup gh action
BioPhoton Nov 10, 2024
5211673
cleanup targets
BioPhoton Nov 10, 2024
cc94675
cleanup cp
BioPhoton Nov 10, 2024
95c482e
wip cp
BioPhoton Nov 10, 2024
1647e38
colocate e2e files
BioPhoton Nov 11, 2024
4a61524
cleanup
BioPhoton Nov 11, 2024
c32e158
cleanup
BioPhoton Nov 11, 2024
6b93d24
wip
BioPhoton Nov 11, 2024
8d8ecc4
wip
BioPhoton Nov 11, 2024
3334e3a
wip
BioPhoton Nov 11, 2024
385f0e3
test(plugin-eslint-e2e): fix tests by separating fixtures from test e…
matejchalk Nov 13, 2024
fa90bcd
refactor e2e env setup
BioPhoton Nov 18, 2024
ded72c0
refactor e2e env setup
BioPhoton Nov 18, 2024
cb4e0f9
cleanup env setup
BioPhoton Nov 18, 2024
22a6908
fix snapshots
BioPhoton Nov 18, 2024
0a477cb
remove check for warning and error
BioPhoton Nov 18, 2024
1b066e0
Update .github/workflows/ci.yml
BioPhoton Nov 18, 2024
d165ddd
Update .github/workflows/ci.yml
BioPhoton Nov 18, 2024
d451294
Merge branch 'split-coverage-e2e' into split-eslint-e2e
BioPhoton Nov 18, 2024
acc5993
clean up merge
BioPhoton Nov 18, 2024
88b13af
Merge branch 'split-eslint-e2e' into split-compare-e2e
BioPhoton Nov 18, 2024
d7964e8
refactor env setup
BioPhoton Nov 18, 2024
2c7516d
add pkg
BioPhoton Nov 18, 2024
11f3153
Merge branch 'main' into split-compare-e2e
BioPhoton Nov 19, 2024
e27d4b6
cleanup env files
BioPhoton Nov 19, 2024
2680495
Merge branch 'main' into split-compare-e2e
BioPhoton Nov 19, 2024
966d7b2
Update .github/workflows/code-pushup.yml
BioPhoton Nov 19, 2024
fcd5596
wip
BioPhoton Nov 19, 2024
779a571
wip
BioPhoton Nov 19, 2024
4526688
wip
BioPhoton Nov 19, 2024
10506cf
test: adjust test env paths
BioPhoton Nov 20, 2024
2bcdae3
Update e2e/cli-e2e/tests/print-config.e2e.test.ts
BioPhoton Nov 21, 2024
027dfbd
Update e2e/plugin-lighthouse-e2e/tests/collect.e2e.test.ts
BioPhoton Nov 21, 2024
b3da1b3
test: update snapshots
BioPhoton Nov 21, 2024
b99bfea
test: cleanup static env
BioPhoton Nov 21, 2024
26d1ac0
test: cleanup snapshots
BioPhoton Nov 21, 2024
b20651b
test: cleanup snapshots
BioPhoton Nov 21, 2024
e73edc2
test: cleanup snapshots
BioPhoton Nov 21, 2024
88bf84c
test: cleanup deps
BioPhoton Nov 22, 2024
c6d1aeb
refactor: fix lint
BioPhoton Nov 22, 2024
93e72fb
refactor: fix format
BioPhoton Nov 22, 2024
092619b
Merge branch 'main' into split-compare-e2e
BioPhoton Nov 22, 2024
e55b282
Merge branch 'main' into split-compare-e2e
BioPhoton Nov 23, 2024
80f7708
test: update snapshots
BioPhoton Nov 23, 2024
8178476
test: cleanup old test setup
BioPhoton Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: E2E test affected projects
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
run: npx nx affected -t nxv-e2e --parallel=1

build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const config: CoreConfig = {

plugins: [
fileSizePlugin({
directory: './dist/examples/react-todos-app',
directory: './dist/packages',
pattern: /\.js$/,
budget: 174_080, // 170 kB
}),
Expand Down
44 changes: 0 additions & 44 deletions e2e/cli-e2e/mocks/fixtures/code-pushup.config.js

This file was deleted.

44 changes: 0 additions & 44 deletions e2e/cli-e2e/mocks/fixtures/code-pushup.config.mjs

This file was deleted.

45 changes: 0 additions & 45 deletions e2e/cli-e2e/mocks/fixtures/code-pushup.config.ts

This file was deleted.

6 changes: 6 additions & 0 deletions e2e/cli-e2e/mocks/fixtures/dummy-setup/code-pushup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';

export default {
plugins: [dummyPlugin()],
categories: [dummyCategory],
};
6 changes: 6 additions & 0 deletions e2e/cli-e2e/mocks/fixtures/dummy-setup/code-pushup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';

export default {
plugins: [dummyPlugin()],
categories: [dummyCategory],
};
6 changes: 6 additions & 0 deletions e2e/cli-e2e/mocks/fixtures/dummy-setup/code-pushup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';

export default {
plugins: [dummyPlugin()],
categories: [dummyCategory],
};
50 changes: 50 additions & 0 deletions e2e/cli-e2e/mocks/fixtures/dummy-setup/dummy.plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import type { PluginConfig } from '@code-pushup/models';

export const dummyPluginSlug = 'dummy-plugin';

const dummyAuditSlug = 'dummy-audit';
export const dummyAudit = {
slug: dummyAuditSlug,
title: 'Dummy Audit',
description: 'A dummy audit to test the cli.',
};

export const dummyCategory = {
slug: 'dummy-category',
title: 'Dummy Category',
refs: [
{
type: 'audit',
plugin: dummyPluginSlug,
slug: dummyAuditSlug,
weight: 1,
},
],
};

export function create(): PluginConfig {
return {
slug: dummyPluginSlug,
title: 'Dummy Plugin',
icon: 'folder-javascript',
description: 'A dummy plugin to test the cli.',
runner: async () => {
const itemCount = JSON.parse(
await readFile(join('src', 'items.json'), 'utf-8'),
).length;
return [
{
...dummyAudit,
slug: dummyAuditSlug,
score: itemCount < 10 ? itemCount / 10 : 1,
value: itemCount,
},
];
},
audits: [dummyAudit],
};
}

export default create;
1 change: 1 addition & 0 deletions e2e/cli-e2e/mocks/fixtures/dummy-setup/src/items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1, 2, 3]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';

export default {
plugins: [dummyPlugin()],
categories: [dummyCategory],
};
50 changes: 50 additions & 0 deletions e2e/cli-e2e/mocks/fixtures/existing-reports/dummy.plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import type { PluginConfig } from '@code-pushup/models';

export const dummyPluginSlug = 'dummy-plugin';

const dummyAuditSlug = 'dummy-audit';
export const dummyAudit = {
slug: dummyAuditSlug,
title: 'Dummy Audit',
description: 'A dummy audit to test the cli.',
};

export const dummyCategory = {
slug: 'dummy-category',
title: 'Dummy Category',
refs: [
{
type: 'audit',
plugin: dummyPluginSlug,
slug: dummyAuditSlug,
weight: 1,
},
],
};

export function create(): PluginConfig {
return {
slug: dummyPluginSlug,
title: 'Dummy Plugin',
icon: 'folder-javascript',
description: 'A dummy plugin to test the cli.',
runner: async () => {
const itemCount = JSON.parse(
await readFile(join('src', 'items.json'), 'utf-8'),
).length;
return [
{
...dummyAudit,
slug: dummyAuditSlug,
score: itemCount < 10 ? itemCount / 10 : 1,
value: itemCount,
},
];
},
audits: [dummyAudit],
};
}

export default create;
78 changes: 0 additions & 78 deletions e2e/cli-e2e/mocks/fixtures/lcov.info

This file was deleted.

13 changes: 2 additions & 11 deletions e2e/cli-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,13 @@
"lintFilePatterns": ["e2e/cli-e2e/**/*.ts"]
}
},
"e2e-old": {
"e2e": {
"executor": "@nx/vite:test",
"options": {
"configFile": "e2e/cli-e2e/vite.config.e2e.ts"
}
}
},
"implicitDependencies": [
"models",
"utils",
"core",
"cli",
"plugin-eslint",
"plugin-coverage",
"plugin-js-packages",
"react-todos-app"
],
"implicitDependencies": ["cli"],
"tags": ["scope:core", "scope:plugin", "type:e2e"]
}
Loading
Loading