Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 6 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ jobs:
run: npm run typecheck
- name: Unit Tests
run: npm run unit

- name: Coverage Report
if: always() # Also generate the report if tests are failing
continue-on-error: true # Do not fail if there is an error during reporting
uses: davelosert/vitest-coverage-report-action@v2

- name: E2E Tests
run: npm run e2e

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

coverage-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 24
cache: npm
# FIXME: add vitest coverage report (2.0)

code-style-check:
runs-on: ubuntu-latest
steps:
Expand Down
134 changes: 67 additions & 67 deletions tests/e2e/commands.test.ts

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions tests/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export function getParams(indexEntryPoint: string, args: string[] = []): string[

export function getCommandOutput(
args: string[],
env?: Record<string, string>,
options?: { testPath?: string }
options?: { env?: Record<string, string>; testPath?: string }
) {
const result = spawnSync('node', args, {
encoding: 'utf-8',
Expand All @@ -20,7 +19,7 @@ export function getCommandOutput(
NODE_ENV: 'test',
NO_COLOR: 'TRUE',
FORCE_COLOR: '0',
...env,
...options?.env,
},
cwd: options?.testPath,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ apis:
rules:
info-license: error
test@external-url:
root: https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml
root: https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/tests/e2e/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml
rules:
info-contact: error
plugins:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ components:
bundling nested/openapi/main.yaml using configuration for api 'test@fs'...
📦 Created a bundle for nested/openapi/main.yaml at stdout <test>ms.
🧹 Removed 1 unused components.
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'...
📦 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.
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'...
📦 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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[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] 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

Info object should contain `contact` field.

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



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'...
https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/__tests__/miscellaneous/apply-per-api-decorators/nested/openapi/main.yaml: validated in <test>ms
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'...
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

❌ Validation failed with 1 error.
run `redocly lint --generate-ignore-file` to add all problems to the ignore file.
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/respect/max-steps/max-steps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ test('should quit an infinite loop on REDOCLY_CLI_RESPECT_MAX_STEPS', () => {
]);

const result = getCommandOutput(args, {
REDOCLY_CLI_RESPECT_MAX_STEPS: '10',
env: {
REDOCLY_CLI_RESPECT_MAX_STEPS: '10',
},
});

expect(result).toMatchSnapshot();
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/performance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Test benchmark for Redocly CLI",
"private": true,
"scripts": {
"chart": "node chart.mjs > benchmark_chart.md",
"chart": "node chart.js > benchmark_chart.md",
"make-test": "bash make-test-command.sh"
},
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const configExtension: { [key: string]: ViteUserConfig } = {
include: ['packages/*/src/**/*.test.ts'],
coverage: {
enabled: true,
reporter: ['text', 'json-summary', 'json'],
reportOnFailure: true,
include: [
'packages/cli/src/**/*.ts',
'packages/core/src/**/*.ts',
Expand Down
Loading