Skip to content

Commit dc17031

Browse files
committed
Merge branch 'main' of github.com:getlarge/code-pushup-cli
2 parents 824ccc3 + fa1a993 commit dc17031

File tree

101 files changed

+2483
-1085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2483
-1085
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ jobs:
105105
uses: nrwl/nx-set-shas@v4
106106
- name: Install dependencies
107107
run: npm ci
108+
- name: Set custom Chrome path for Windows only
109+
if: matrix.os == 'windows-latest'
110+
# This path is considered in `testing/setup/src/lib/chrome-path-setup.ts` and used in different test configurations
111+
run: |
112+
echo "CUSTOM_CHROME_PATH=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
113+
shell: pwsh
114+
#- name: Log all environment variables
115+
# run: |
116+
# printenv
108117
- name: Integration test affected projects
109118
run: npx nx affected -t integration-test --parallel=3 --coverage.enabled
110119

.github/workflows/code-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
- name: Install dependencies
3535
run: npm ci
3636
- name: Execute all tests and generate coverage reports
37-
run: npx nx run ${{ matrix.lib }}:${{ matrix.scope }}-test --coverage.enabled
37+
run: npx nx run ${{ matrix.lib }}:${{ matrix.scope }}-test --coverage.enabled --skipNxCache
3838
- name: Upload coverage reports to Codecov
3939
uses: codecov/codecov-action@v4
4040
with:
41-
directory: ./coverage/${{ matrix.lib }}/${{ matrix.scope }}-tests/
41+
directory: coverage/${{ matrix.lib }}/${{ matrix.scope }}-tests/
4242
files: ./lcov.info
4343
flags: ${{ matrix.lib }}-${{ matrix.scope }}
4444
token: ${{ secrets.CODECOV_TOKEN }}

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ Make sure to install dependencies:
1212
npm install
1313
```
1414

15+
## Environment Variables
16+
17+
This table provides a quick overview of the environmental setup, with detailed explanations in the corresponding sections.
18+
19+
| Feature | Local Default | CI Default | Description |
20+
| -------------------------------- | ------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
21+
| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. |
22+
| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). |
23+
| Quality Pipeline | Off | On | Runs all plugins against the codebase. |
24+
25+
**❗️** Test Inclusion Logic
26+
27+
- `INCLUDE_SLOW_TESTS='false'` skips long tests.
28+
- without `INCLUDE_SLOW_TESTS`, tests run if `CI` is set.
29+
30+
**❗️❗️** Windows specific path set only in CI
31+
32+
- some setups also require this setting locally
33+
1534
## Development
1635

1736
Refer to docs on [how to run tasks in Nx](https://nx.dev/core-features/run-tasks).
@@ -41,6 +60,15 @@ npx nx affected:lint
4160
npx nx code-pushup -- collect
4261
```
4362

63+
## Testing
64+
65+
Some of the plugins have a longer runtime. In order to ensure better DX, longer tests are excluded by default when executing tests locally.
66+
67+
You can control the execution of long-running tests over the `INCLUDE_SLOW_TESTS` environment variable.
68+
69+
To change this setup, open (or create) the `.env` file in the root folder.
70+
Edit or add the environment variable there as follows: `INCLUDE_SLOW_TESTS=true`.
71+
4472
## Git
4573

4674
Commit messages must follow [conventional commits](https://conventionalcommits.org/) format.

code-pushup.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,22 @@ const config: CoreConfig = {
8787
{
8888
slug: 'bug-prevention',
8989
title: 'Bug prevention',
90+
description: 'Lint rules that find **potential bugs** in your code.',
9091
refs: [{ type: 'group', plugin: 'eslint', slug: 'problems', weight: 1 }],
9192
},
9293
{
9394
slug: 'code-style',
9495
title: 'Code style',
96+
description:
97+
'Lint rules that promote **good practices** and consistency in your code.',
9598
refs: [
9699
{ type: 'group', plugin: 'eslint', slug: 'suggestions', weight: 1 },
97100
],
98101
},
99102
{
100103
slug: 'code-coverage',
101104
title: 'Code coverage',
105+
description: 'Measures how much of your code is **covered by tests**.',
102106
refs: [
103107
{
104108
type: 'group',
@@ -111,6 +115,7 @@ const config: CoreConfig = {
111115
{
112116
slug: 'security',
113117
title: 'Security',
118+
description: 'Finds known **vulnerabilities** in 3rd-party packages.',
114119
refs: [
115120
{
116121
type: 'group',
@@ -123,6 +128,7 @@ const config: CoreConfig = {
123128
{
124129
slug: 'updates',
125130
title: 'Updates',
131+
description: 'Finds **outdated** 3rd-party packages.',
126132
refs: [
127133
{
128134
type: 'group',

packages/cli/project.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@
3131
},
3232
"unit-test": {
3333
"executor": "@nx/vite:test",
34-
"outputs": ["{options.reportsDirectory}"],
3534
"options": {
36-
"config": "packages/cli/vite.config.unit.ts",
37-
"reportsDirectory": "../../coverage/cli/unit-tests"
35+
"config": "packages/cli/vite.config.unit.ts"
3836
}
3937
},
4038
"integration-test": {
4139
"executor": "@nx/vite:test",
42-
"outputs": ["{options.reportsDirectory}"],
4340
"options": {
44-
"config": "packages/cli/vite.config.integration.ts",
45-
"reportsDirectory": "../../coverage/cli/integration-tests"
41+
"config": "packages/cli/vite.config.integration.ts"
4642
}
4743
},
4844
"run-help": {

packages/cli/vite.config.integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineConfig({
1616
coverage: {
1717
reporter: ['text', 'lcov'],
1818
reportsDirectory: '../../coverage/cli/integration-tests',
19-
exclude: ['mocks/**'],
19+
exclude: ['mocks/**', '**/types.ts'],
2020
},
2121
environment: 'node',
2222
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

packages/cli/vite.config.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineConfig({
1616
coverage: {
1717
reporter: ['text', 'lcov'],
1818
reportsDirectory: '../../coverage/cli/unit-tests',
19-
exclude: ['mocks/**'],
19+
exclude: ['mocks/**', '**/types.ts'],
2020
},
2121
environment: 'node',
2222
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

packages/core/project.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@
3131
},
3232
"unit-test": {
3333
"executor": "@nx/vite:test",
34-
"outputs": ["{options.reportsDirectory}"],
3534
"options": {
36-
"config": "packages/core/vite.config.unit.ts",
37-
"reportsDirectory": "../../coverage/core/unit-tests"
35+
"config": "packages/core/vite.config.unit.ts"
3836
}
3937
},
4038
"integration-test": {
4139
"executor": "@nx/vite:test",
42-
"outputs": ["{options.reportsDirectory}"],
4340
"options": {
44-
"config": "packages/core/vite.config.integration.ts",
45-
"reportsDirectory": "../../coverage/core/integration-tests"
41+
"config": "packages/core/vite.config.integration.ts"
4642
}
4743
}
4844
},

packages/core/vite.config.integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineConfig({
1616
coverage: {
1717
reporter: ['text', 'lcov'],
1818
reportsDirectory: '../../coverage/core/integration-tests',
19-
exclude: ['mocks/**'],
19+
exclude: ['mocks/**', '**/types.ts'],
2020
},
2121
environment: 'node',
2222
include: ['src/**/*.integration.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

packages/core/vite.config.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineConfig({
1616
coverage: {
1717
reporter: ['text', 'lcov'],
1818
reportsDirectory: '../../coverage/core/unit-tests',
19-
exclude: ['mocks/**'],
19+
exclude: ['mocks/**', '**/types.ts'],
2020
},
2121
environment: 'node',
2222
include: ['src/**/*.unit.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

0 commit comments

Comments
 (0)