Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
09b1556
setup e2e for cli-e2e
BioPhoton Oct 15, 2024
de2aa9a
wip
BioPhoton Oct 15, 2024
60e2610
wip
BioPhoton Oct 15, 2024
93ef30c
wip
BioPhoton Oct 15, 2024
e98ea02
fix
BioPhoton Oct 15, 2024
abc7d20
fix
BioPhoton Oct 15, 2024
909e939
fix
BioPhoton Oct 15, 2024
30ba251
fix
BioPhoton Oct 15, 2024
e15c258
fix
BioPhoton Oct 15, 2024
6ed85db
Update .github/workflows/ci.yml
BioPhoton Oct 15, 2024
48f8fea
feat: make portal-client dependency optional
hanna-skryl Oct 11, 2024
5c2237d
test(plugin-lighthouse): update expected output
hanna-skryl Oct 12, 2024
8165f24
chore(ci): generate new package with @nx/js:library
matejchalk Oct 7, 2024
b2ab695
build(ci): customize package configuration from Nx generator
matejchalk Oct 7, 2024
c26c8b3
feat(ci): move in monorepo code from github-action
matejchalk Oct 7, 2024
2ca70bc
feat(ci): move in code from github-action for issues, git diff and co…
matejchalk Oct 7, 2024
c81dbad
refactor(ci): refine type definitions
matejchalk Oct 10, 2024
dfb9df1
feat(ci): move in code for posting comment, generalized to any provider
matejchalk Oct 10, 2024
32b91d1
feat(ci): move in main run functions from github-action and adapt
matejchalk Oct 11, 2024
dad8738
test(ci): add integration tests for main function
matejchalk Oct 14, 2024
131d35d
test(ci-e2e): basic e2e tests for ci push and pull request flows
matejchalk Oct 14, 2024
0f26697
docs(ci): document package and exports
matejchalk Oct 14, 2024
dd0a42a
test(ci-e2e): use new verdaccio setup and test directory structure
matejchalk Oct 15, 2024
c0df0c5
test(ci,test-utils,ci-e2e,utils): reuse git utils
matejchalk Oct 15, 2024
7c4a8dd
refactor(ci): extract projectToFilename to utils
matejchalk Oct 15, 2024
76db1f5
refactor(ci): rename command functions to prevent confusion with cli …
matejchalk Oct 15, 2024
b10a2d9
docs(ci): minor readme improvements
matejchalk Oct 15, 2024
1561a8a
test(ci): unit test comment helpers
matejchalk Oct 15, 2024
5f0981d
test(ci-e2e): fix setup by listing indirect dependencies as implicit
matejchalk Oct 15, 2024
08335c4
test(ci): fix expected paths on Windows
matejchalk Oct 15, 2024
d747efb
fix
BioPhoton Oct 15, 2024
3bfaded
Merge branch 'main' into use-nx-verdaccio-for-cli-e2e
BioPhoton Oct 16, 2024
efae911
Merge branch 'main' into use-nx-verdaccio-for-cli-e2e
BioPhoton Oct 16, 2024
c115c9d
Merge branch 'main' into use-nx-verdaccio-for-cli-e2e
BioPhoton Oct 17, 2024
5009927
update nxv
BioPhoton Oct 19, 2024
3e8b5a1
merge main
BioPhoton Oct 19, 2024
7ffa83e
merge main
BioPhoton Oct 19, 2024
ce132b3
update nxv
BioPhoton Oct 20, 2024
4255178
update pkg
BioPhoton Oct 20, 2024
21d426a
update nxv
BioPhoton Oct 22, 2024
7c7a207
merge main
BioPhoton Nov 9, 2024
bf5638c
Merge branch 'main' into use-nx-verdaccio-for-cli-e2e
BioPhoton Nov 9, 2024
baa60c0
merge main
BioPhoton Nov 9, 2024
2e050b9
update nxv
BioPhoton Nov 9, 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- 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 run cli-e2e:nxv-e2e

build:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ node_modules
/connect.lock
/coverage
/examples/react-todos-app/coverage
/examples/react-todos-app/package.json
/examples/react-todos-app/package-lock.json
/libpeerconnection.log
npm-debug.log
yarn-error.log
Expand Down
11 changes: 7 additions & 4 deletions e2e/cli-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
"lintFilePatterns": ["e2e/cli-e2e/**/*.ts"]
}
},
"nxv-env-setup": {
"options": {
"environmentRoot": "examples/react-todos-app"
}
},
"e2e-old": {
"executor": "@nx/vite:test",
"options": {
"configFile": "e2e/cli-e2e/vite.config.e2e.ts"
"configFile": "e2e/cli-e2e/vite.config.e2e.ts",
"environmentRoot": "examples/react-todos-app"
}
}
},
"implicitDependencies": [
"models",
"utils",
"core",
"cli",
"plugin-eslint",
"plugin-coverage",
Expand Down
35 changes: 26 additions & 9 deletions e2e/cli-e2e/tests/collect.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ describe('CLI collect', () => {

it('should run ESLint plugin and create report.json', async () => {
const { code, stderr } = await executeProcess({
command: 'code-pushup',
args: ['collect', '--no-progress', '--onlyPlugins=eslint'],
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--no-progress',
'--onlyPlugins=eslint',
],
cwd: 'examples/react-todos-app',
});

Expand Down Expand Up @@ -83,14 +88,16 @@ describe('CLI collect', () => {
);

const { code, stderr } = await executeProcess({
command: 'code-pushup',
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--no-progress',
`--config=${configPath}`,
'--persist.outputDir=tmp/e2e',
'--onlyPlugins=coverage',
],
cwd: 'examples/react-todos-app',
});

expect(code).toBe(0);
Expand All @@ -104,8 +111,13 @@ describe('CLI collect', () => {

it('should run Code coverage plugin that runs coverage tool and creates report.json', async () => {
const { code, stderr } = await executeProcess({
command: 'code-pushup',
args: ['collect', '--no-progress', '--onlyPlugins=coverage'],
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--no-progress',
'--onlyPlugins=coverage',
],
cwd: 'examples/react-todos-app',
});

Expand All @@ -120,8 +132,13 @@ describe('CLI collect', () => {

it('should create report.md', async () => {
const { code, stderr } = await executeProcess({
command: 'code-pushup',
args: ['collect', '--persist.format=md', '--no-progress'],
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--persist.format=md',
'--no-progress',
],
cwd: 'examples/react-todos-app',
});

Expand All @@ -137,8 +154,8 @@ describe('CLI collect', () => {

it('should print report summary to stdout', async () => {
const { code, stdout, stderr } = await executeProcess({
command: 'code-pushup',
args: ['collect', '--no-progress'],
command: 'npx',
args: ['@code-pushup/cli', 'collect', '--no-progress'],
cwd: 'examples/react-todos-app',
});

Expand Down
9 changes: 6 additions & 3 deletions e2e/cli-e2e/tests/compare.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ describe('CLI compare', () => {
}
await cleanTestFolder('tmp/e2e/react-todos-app');
await executeProcess({
command: 'code-pushup',
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--persist.filename=source-report',
'--onlyPlugins=eslint',
Expand All @@ -28,8 +29,9 @@ describe('CLI compare', () => {
cwd: 'examples/react-todos-app',
});
await executeProcess({
command: 'code-pushup',
command: 'npx',
args: [
'@code-pushup/cli',
'collect',
'--persist.filename=target-report',
'--onlyPlugins=eslint',
Expand All @@ -45,8 +47,9 @@ describe('CLI compare', () => {

it('should compare report.json files and create report-diff.json and report-diff.md', async () => {
await executeProcess({
command: 'code-pushup',
command: 'npx',
args: [
'@code-pushup/cli',
'compare',
'--before=../../tmp/e2e/react-todos-app/source-report.json',
'--after=../../tmp/e2e/react-todos-app/target-report.json',
Expand Down
15 changes: 9 additions & 6 deletions e2e/cli-e2e/tests/help.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { executeProcess } from '@code-pushup/utils';
describe('CLI help', () => {
it('should print help with help command', async () => {
const { code, stdout, stderr } = await executeProcess({
command: 'code-pushup',
args: ['help'],
command: 'npx',
args: ['@code-pushup/cli', 'help'],
cwd: 'examples/react-todos-app',
});
expect(code).toBe(0);
expect(stderr).toBe('');
Expand All @@ -14,12 +15,14 @@ describe('CLI help', () => {

it('should produce the same output to stdout for both help argument and help command', async () => {
const helpArgResult = await executeProcess({
command: 'code-pushup',
args: ['help'],
command: 'npx',
args: ['@code-pushup/cli', 'help'],
cwd: 'examples/react-todos-app',
});
const helpCommandResult = await executeProcess({
command: 'code-pushup',
args: ['--help'],
command: 'npx',
args: ['@code-pushup/cli', '--help'],
cwd: 'examples/react-todos-app',
});
expect(helpArgResult.code).toBe(0);
expect(helpCommandResult.code).toBe(0);
Expand Down
22 changes: 9 additions & 13 deletions e2e/cli-e2e/tests/print-config.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,45 @@ const extensions = ['js', 'mjs', 'ts'] as const;
export const configFilePath = (ext: (typeof extensions)[number]) =>
join(process.cwd(), `e2e/cli-e2e/mocks/fixtures/code-pushup.config.${ext}`);

describe('print-config', () => {
describe('CLI print-config', () => {
it.each(extensions)(
'should load .%s config file with correct arguments',
async ext => {
const { code, stdout } = await executeProcess({
command: 'code-pushup',
command: 'npx',
args: [
'@code-pushup/cli',
'print-config',
'--no-progress',
`--config=${configFilePath(ext)}`,
'--tsconfig=tsconfig.base.json',
'--persist.outputDir=output-dir',
'--persist.format=md',
`--persist.filename=${ext}-report`,
'--onlyPlugins=coverage',
],
cwd: 'examples/react-todos-app',
});

expect(code).toBe(0);

expect(JSON.parse(stdout)).toEqual(
expect.objectContaining({
config: expect.stringContaining(`code-pushup.config.${ext}`),
tsconfig: 'tsconfig.base.json',
// filled by command options
persist: {
outputDir: 'output-dir',
filename: `${ext}-report`,
format: ['md'],
},
upload: {
organization: 'code-pushup',
project: `cli-${ext}`,
apiKey: 'e2e-api-key',
server: 'https://e2e.com/api',
},
plugins: [
plugins: expect.arrayContaining([
expect.objectContaining({
slug: 'coverage',
title: 'Code coverage',
}),
],
categories: [expect.objectContaining({ slug: 'code-coverage' })],
]),
categories: expect.arrayContaining([
expect.objectContaining({ slug: 'code-coverage' }),
]),
onlyPlugins: ['coverage'],
}),
);
Expand Down
1 change: 0 additions & 1 deletion e2e/cli-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.e2e.ts'],
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
},
});
69 changes: 0 additions & 69 deletions examples/react-todos-app/.eslintrc.js

This file was deleted.

64 changes: 64 additions & 0 deletions examples/react-todos-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"plugins": ["react", "react-hooks"],
"overrides": [
{
"env": {
"node": true
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"no-cond-assign": "warn",
"no-const-assign": "warn",
"no-debugger": "warn",
"no-invalid-regexp": "warn",
"no-undef": "warn",
"no-unreachable-loop": "warn",
"no-unsafe-negation": "warn",
"no-unsafe-optional-chaining": "warn",
"no-unused-vars": "warn",
"use-isnan": "warn",
"valid-typeof": "warn",
"arrow-body-style": "warn",
"camelcase": "warn",
"curly": "warn",
"eqeqeq": "warn",
"max-lines-per-function": "warn",
"max-lines": "warn",
"no-shadow": "warn",
"no-var": "warn",
"object-shorthand": "warn",
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-object-spread": "warn",
"yoda": "warn",
"react/jsx-key": "warn",
"react/prop-types": "warn",
"react/react-in-jsx-scope": "warn",
"react/jsx-uses-vars": "warn",
"react/jsx-uses-react": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
Loading
Loading