Skip to content

Commit d39585e

Browse files
authored
chore: fix test links and add coverage report (#2393)
1 parent cf26d60 commit d39585e

File tree

10 files changed

+87
-88
lines changed

10 files changed

+87
-88
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
run: npm run typecheck
2727
- name: Unit Tests
2828
run: npm run unit
29+
30+
- name: Coverage Report
31+
if: always() # Also generate the report if tests are failing
32+
continue-on-error: true # Do not fail if there is an error during reporting
33+
uses: davelosert/vitest-coverage-report-action@v2
34+
2935
- name: E2E Tests
3036
run: npm run e2e
3137

@@ -48,16 +54,6 @@ jobs:
4854
- name: Definition test
4955
run: redocly lint resources/rebilly.yaml --format=stylish
5056

51-
coverage-report:
52-
runs-on: ubuntu-latest
53-
steps:
54-
- uses: actions/checkout@v4
55-
- uses: actions/setup-node@v3
56-
with:
57-
node-version: 24
58-
cache: npm
59-
# FIXME: add vitest coverage report (2.0)
60-
6157
code-style-check:
6258
runs-on: ubuntu-latest
6359
steps:

tests/e2e/commands.test.ts

Lines changed: 67 additions & 67 deletions
Large diffs are not rendered by default.

tests/e2e/helpers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export function getParams(indexEntryPoint: string, args: string[] = []): string[
99

1010
export function getCommandOutput(
1111
args: string[],
12-
env?: Record<string, string>,
13-
options?: { testPath?: string }
12+
options?: { env?: Record<string, string>; testPath?: string }
1413
) {
1514
const result = spawnSync('node', args, {
1615
encoding: 'utf-8',
@@ -20,7 +19,7 @@ export function getCommandOutput(
2019
NODE_ENV: 'test',
2120
NO_COLOR: 'TRUE',
2221
FORCE_COLOR: '0',
23-
...env,
22+
...options?.env,
2423
},
2524
cwd: options?.testPath,
2625
});

tests/e2e/miscellaneous/apply-per-api-decorators/nested/redocly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apis:
77
rules:
88
info-license: error
99
test@external-url:
10-
root: https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml
10+
root: https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml
1111
rules:
1212
info-contact: error
1313
plugins:

tests/e2e/miscellaneous/apply-per-api-decorators/snapshot.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ components:
1515
bundling nested/openapi/main.yaml using configuration for api 'test@fs'...
1616
📦 Created a bundle for nested/openapi/main.yaml at stdout <test>ms.
1717
🧹 Removed 1 unused components.
18-
bundling https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml using configuration for api 'test@external-url'...
19-
📦 Created a bundle for https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml at stdout <test>ms.
18+
bundling https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml using configuration for api 'test@external-url'...
19+
📦 Created a bundle for https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml at stdout <test>ms.

tests/e2e/miscellaneous/apply-per-api-decorators/snapshot_3.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[1] https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml:2:1 at #/info/contact
1+
[1] https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml:2:1 at #/info/contact
22

33
Info object should contain `contact` field.
44

@@ -12,8 +12,8 @@ Error was generated by the info-contact rule.
1212

1313

1414

15-
validating https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml using lint rules for api 'test@external-url'...
16-
https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml: validated in <test>ms
15+
validating https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml using lint rules for api 'test@external-url'...
16+
https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml: validated in <test>ms
1717

1818
❌ Validation failed with 1 error.
1919
run `redocly lint --generate-ignore-file` to add all problems to the ignore file.

tests/e2e/respect/max-steps/max-steps.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ test('should quit an infinite loop on REDOCLY_CLI_RESPECT_MAX_STEPS', () => {
1616
]);
1717

1818
const result = getCommandOutput(args, {
19-
REDOCLY_CLI_RESPECT_MAX_STEPS: '10',
19+
env: {
20+
REDOCLY_CLI_RESPECT_MAX_STEPS: '10',
21+
},
2022
});
2123

2224
expect(result).toMatchSnapshot();

tests/performance/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Test benchmark for Redocly CLI",
55
"private": true,
66
"scripts": {
7-
"chart": "node chart.mjs > benchmark_chart.md",
7+
"chart": "node chart.js > benchmark_chart.md",
88
"make-test": "bash make-test-command.sh"
99
},
1010
"dependencies": {

vitest.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const configExtension: { [key: string]: ViteUserConfig } = {
88
include: ['packages/*/src/**/*.test.ts'],
99
coverage: {
1010
enabled: true,
11+
reporter: ['text', 'json-summary', 'json'],
12+
reportOnFailure: true,
1113
include: [
1214
'packages/cli/src/**/*.ts',
1315
'packages/core/src/**/*.ts',

0 commit comments

Comments
 (0)