Improves assertion errors#535
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request improves developer feedback during CI runs by (1) standardizing how Vitest failures are normalized and rendered in the test-engine reports, and (2) refactoring integration tests to use shared assertion helpers that produce clearer, more actionable failure output.
Changes:
- Enhanced
scripts/test-engine.mjsto normalize/sanitize failure messages and include compacted “reason” plus additional “detail” lines in Markdown/console output, and a compacted reason in JUnit output. - Introduced
src/integration-tests/fixtures/assertionHelpers.tsand refactored multiple integration tests to useassertApiResult,assertApiFailure, andassertApiFailureCodefor clearer intent and better error messages. - Reduced duplicated per-test-file assertion boilerplate in repository integration tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/integration-tests/submodelService.integration.test.ts | Swaps expect(...success) checks for shared API result assertions. |
| src/integration-tests/submodelRepo.integration.test.ts | Replaces local assertion helpers with shared helpers; adds explicit status checks for failure-code cases. |
| src/integration-tests/submodelRegistry.integration.test.ts | Refactors success/failure assertions to shared helpers for clearer failures. |
| src/integration-tests/fixtures/assertionHelpers.ts | Adds reusable assertion utilities that format API failure context consistently. |
| src/integration-tests/conceptDescriptionRepo.integration.test.ts | Refactors to shared helpers; adds operation/status doc blocks for PUT-by-ID coverage cases. |
| src/integration-tests/aasxFile.integration.test.ts | Uses shared helpers; improves fixture seeding failure message context. |
| src/integration-tests/aasService.integration.test.ts | Refactors service-level integration assertions to shared helpers. |
| src/integration-tests/aasRepo.integration.test.ts | Removes duplicated local helper logic; uses shared helpers and adds explicit status assertions for several cases. |
| src/integration-tests/aasRegistry.integration.test.ts | Refactors registry integration assertions to shared helpers. |
| src/integration-tests/aasDiscovery.integration.test.ts | Refactors to shared helpers; improves fixture seeding failure message context. |
| scripts/test-engine.mjs | Normalizes failure messages and improves failure rendering across Markdown/JUnit/console reports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves test reporting and integration test code quality. The main changes include enhanced handling and formatting of test failure messages in the test engine, and refactoring integration tests to use clearer assertion helpers for API responses.
Test reporting improvements:
normalizeFailureMessage,sanitizeFailureMessages,compactFailureReason,formatFailureDetailLine) to clean up and standardize failure messages inscripts/test-engine.mjs. This ensures consistent formatting and better readability in reports.Integration test refactoring:
expect(response.success)assertions withassertApiResultandassertApiFailurehelper functions insrc/integration-tests/aasDiscovery.integration.test.tsandsrc/integration-tests/aasRegistry.integration.test.ts, making test intent clearer and reducing boilerplate. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]These changes result in more maintainable and robust test infrastructure, with clearer output and more reliable assertions.