Skip to content
Merged
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
12 changes: 11 additions & 1 deletion typescript/packages/cli/tests/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@ function run(args: ReadonlyArray<string>, cwd: string) {
return spawnSync(process.execPath, [BIN_TS, ...args], { cwd, encoding: 'utf8' })
}

// Node's notice is two lines, each with a fixed prefix:
//
// (node:12345) ExperimentalWarning: globSync is an experimental feature ...
// (Use `node --trace-warnings ...` to show where the warning was created)
//
// Anchor on those prefixes rather than matching the text anywhere in the line,
// so a CLI-emitted line that happens to contain it is still asserted on.
const NODE_WARNING = /^\(node:\d+\) ExperimentalWarning:/
const NODE_WARNING_HINT = /^\(Use `node --trace-warnings/

function filterWarnings(stderr: string): string {
return stderr
.split('\n')
.filter((line) => !line.includes('ExperimentalWarning') && !line.includes('--trace-warnings'))
.filter((line) => !NODE_WARNING.test(line) && !NODE_WARNING_HINT.test(line))
.join('\n')
.trim()
}
Expand Down