-
Notifications
You must be signed in to change notification settings - Fork 421
chore: Switch to using Node built-in test runner #2387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c7d2d69
chore: Switch to using Node built-in test runner
jsumners-nr 2eadfe3
address feedback
jsumners-nr ea076a7
make reporter honor OUTPUT_MODE
jsumners-nr 19ffc51
use borp to solve expansion woes
jsumners-nr a2efcec
integration tests insane timeout
jsumners-nr 9e27541
add summary report to reporter
jsumners-nr 6880d3e
add timeouts to tests
jsumners-nr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
address feedback
- Loading branch information
commit 2eadfe38b02e63ece7771a02ac152c073c775fb0
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright 2024 New Relic Corporation. All rights reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| // This file provides a custom test reporter for the native test runner | ||
| // included in Node.js >=18. The default `spec` reporter writes too much | ||
| // information to be usable in CI, and the `dot` reporter hides which tests | ||
| // failed. This custom reporter outputs nothing for successful tests, and | ||
| // outputs the failing test file when any failing test has occurred. | ||
| // | ||
| // See https://nodejs.org/api/test.html#custom-reporters. | ||
| 'use strict' | ||
|
|
||
| const { Transform } = require('node:stream') | ||
| const testReporter = new Transform({ | ||
| writableObjectMode: true, | ||
| transform(event, encoding, callback) { | ||
| if (event.type !== 'test:fail') { | ||
| // We don't want to write out anything for any cases other than the | ||
| // failure case. | ||
| return callback(null, null) | ||
| } | ||
|
|
||
| // Once v18 has been dropped, we might want to revisit the output of | ||
| // failure cases. The `event` object is supposed to provide things like | ||
| // the failing line number and column, along with the failing test name. | ||
| // But on v18, we seem to only get `1` for both line and column, and the | ||
| // test name gets set to the `file`. So there isn't really any point in | ||
| // trying to provide more useful reports here while we need to support v18. | ||
| // | ||
| // The issue may also stem from the current test suites still being based | ||
| // on `tap`. Once we are able to migrate the actual test code to `node:test` | ||
| // we should revisit this reporter to determine if we can improve it. | ||
| // | ||
| // See https://nodejs.org/api/test.html#event-testfail. | ||
| callback(null, `failed: ${event.data.file}`) | ||
| } | ||
| }) | ||
|
|
||
| module.exports = testReporter | ||
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.
Uh oh!
There was an error while loading. Please reload this page.