mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
test: put helper in test-runner-output into common
PR-URL: https://github.com/nodejs/node/pull/60330 Refs: https://github.com/nodejs/node/issues/55390 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
This commit is contained in:
parent
5bd2152b89
commit
bfcf2f7a15
|
|
@ -4,6 +4,7 @@ const path = require('node:path');
|
||||||
const test = require('node:test');
|
const test = require('node:test');
|
||||||
const fs = require('node:fs/promises');
|
const fs = require('node:fs/promises');
|
||||||
const assert = require('node:assert/strict');
|
const assert = require('node:assert/strict');
|
||||||
|
const { hostname } = require('node:os');
|
||||||
|
|
||||||
const stackFramesRegexp = /(?<=\n)(\s+)((.+?)\s+\()?(?:\(?(.+?):(\d+)(?::(\d+))?)\)?(\s+\{)?(\[\d+m)?(\n|$)/g;
|
const stackFramesRegexp = /(?<=\n)(\s+)((.+?)\s+\()?(?:\(?(.+?):(\d+)(?::(\d+))?)\)?(\s+\{)?(\[\d+m)?(\n|$)/g;
|
||||||
const windowNewlineRegexp = /\r/g;
|
const windowNewlineRegexp = /\r/g;
|
||||||
|
|
@ -100,6 +101,97 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ...
|
||||||
await assertSnapshot(transform(`${stdout}${stderr}`), filename);
|
await assertSnapshot(transform(`${stdout}${stderr}`), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replaceTestDuration(str) {
|
||||||
|
return str
|
||||||
|
.replaceAll(/duration_ms: [0-9.]+/g, 'duration_ms: *')
|
||||||
|
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *');
|
||||||
|
}
|
||||||
|
|
||||||
|
const root = path.resolve(__dirname, '..', '..');
|
||||||
|
const color = '(\\[\\d+m)';
|
||||||
|
const stackTraceBasePath = new RegExp(`${color}\\(${root.replaceAll(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g');
|
||||||
|
|
||||||
|
function replaceSpecDuration(str) {
|
||||||
|
return str
|
||||||
|
.replaceAll(/[0-9.]+ms/g, '*ms')
|
||||||
|
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
|
||||||
|
.replace(stackTraceBasePath, '$3');
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceJunitDuration(str) {
|
||||||
|
return str
|
||||||
|
.replaceAll(/time="[0-9.]+"/g, 'time="*"')
|
||||||
|
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
|
||||||
|
.replaceAll(`hostname="${hostname()}"`, 'hostname="HOSTNAME"')
|
||||||
|
.replaceAll(/file="[^"]*"/g, 'file="*"')
|
||||||
|
.replace(stackTraceBasePath, '$3');
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeWindowsPathEscaping(str) {
|
||||||
|
return common.isWindows ? str.replaceAll(/\\\\/g, '\\') : str;
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceTestLocationLine(str) {
|
||||||
|
return str.replaceAll(/(js:)(\d+)(:\d+)/g, '$1(LINE)$3');
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Node test coverage returns results for all files called by the test. This
|
||||||
|
// will make the output file change if files like test/common/index.js change.
|
||||||
|
// This transform picks only the first line and then the lines from the test
|
||||||
|
// file.
|
||||||
|
function pickTestFileFromLcov(str) {
|
||||||
|
const lines = str.split(/\n/);
|
||||||
|
const firstLineOfTestFile = lines.findIndex(
|
||||||
|
(line) => line.startsWith('SF:') && line.trim().endsWith('output.js'),
|
||||||
|
);
|
||||||
|
const lastLineOfTestFile = lines.findIndex(
|
||||||
|
(line, index) => index > firstLineOfTestFile && line.trim() === 'end_of_record',
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
lines[0] + '\n' + lines.slice(firstLineOfTestFile, lastLineOfTestFile + 1).join('\n') + '\n'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultTransform = transform(
|
||||||
|
replaceWindowsLineEndings,
|
||||||
|
replaceStackTrace,
|
||||||
|
removeWindowsPathEscaping,
|
||||||
|
transformProjectRoot(),
|
||||||
|
replaceWindowsPaths,
|
||||||
|
replaceTestDuration,
|
||||||
|
replaceTestLocationLine,
|
||||||
|
);
|
||||||
|
const specTransform = transform(
|
||||||
|
replaceSpecDuration,
|
||||||
|
replaceWindowsLineEndings,
|
||||||
|
replaceStackTrace,
|
||||||
|
replaceWindowsPaths,
|
||||||
|
);
|
||||||
|
const junitTransform = transform(
|
||||||
|
replaceJunitDuration,
|
||||||
|
replaceWindowsLineEndings,
|
||||||
|
replaceStackTrace,
|
||||||
|
replaceWindowsPaths,
|
||||||
|
);
|
||||||
|
const lcovTransform = transform(
|
||||||
|
replaceWindowsLineEndings,
|
||||||
|
replaceStackTrace,
|
||||||
|
transformProjectRoot(),
|
||||||
|
replaceWindowsPaths,
|
||||||
|
pickTestFileFromLcov,
|
||||||
|
);
|
||||||
|
|
||||||
|
function ensureCwdIsProjectRoot() {
|
||||||
|
if (process.cwd() !== root) {
|
||||||
|
process.chdir(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function canColorize() {
|
||||||
|
// Loading it lazily to avoid breaking `NODE_REGENERATE_SNAPSHOTS`.
|
||||||
|
return require('internal/tty').getColorDepth() > 2;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
assertSnapshot,
|
assertSnapshot,
|
||||||
getSnapshotPath,
|
getSnapshotPath,
|
||||||
|
|
@ -111,4 +203,11 @@ module.exports = {
|
||||||
spawnAndAssert,
|
spawnAndAssert,
|
||||||
transform,
|
transform,
|
||||||
transformProjectRoot,
|
transformProjectRoot,
|
||||||
|
replaceTestDuration,
|
||||||
|
defaultTransform,
|
||||||
|
specTransform,
|
||||||
|
junitTransform,
|
||||||
|
lcovTransform,
|
||||||
|
ensureCwdIsProjectRoot,
|
||||||
|
canColorize,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,358 +0,0 @@
|
||||||
// Flags: --expose-internals
|
|
||||||
import * as common from '../common/index.mjs';
|
|
||||||
import * as fixtures from '../common/fixtures.mjs';
|
|
||||||
import * as snapshot from '../common/assertSnapshot.js';
|
|
||||||
import { describe, it } from 'node:test';
|
|
||||||
import { hostname } from 'node:os';
|
|
||||||
import { chdir, cwd } from 'node:process';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
|
|
||||||
const skipForceColors =
|
|
||||||
process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' ||
|
|
||||||
process.config.variables.node_shared_openssl;
|
|
||||||
|
|
||||||
// We're using dynamic import here to not break `NODE_REGENERATE_SNAPSHOTS`.
|
|
||||||
const canColorize = (await import('internal/tty')).default.getColorDepth() > 2;
|
|
||||||
const skipCoverageColors = !canColorize;
|
|
||||||
|
|
||||||
function replaceTestDuration(str) {
|
|
||||||
return str
|
|
||||||
.replaceAll(/duration_ms: [0-9.]+/g, 'duration_ms: *')
|
|
||||||
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *');
|
|
||||||
}
|
|
||||||
|
|
||||||
const root = fileURLToPath(new URL('../..', import.meta.url)).slice(0, -1);
|
|
||||||
|
|
||||||
const color = '(\\[\\d+m)';
|
|
||||||
const stackTraceBasePath = new RegExp(`${color}\\(${root.replaceAll(/[\\^$*+?.()|[\]{}]/g, '\\$&')}/?${color}(.*)${color}\\)`, 'g');
|
|
||||||
|
|
||||||
function replaceSpecDuration(str) {
|
|
||||||
return str
|
|
||||||
.replaceAll(/[0-9.]+ms/g, '*ms')
|
|
||||||
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
|
|
||||||
.replace(stackTraceBasePath, '$3');
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceJunitDuration(str) {
|
|
||||||
return str
|
|
||||||
.replaceAll(/time="[0-9.]+"/g, 'time="*"')
|
|
||||||
.replaceAll(/duration_ms [0-9.]+/g, 'duration_ms *')
|
|
||||||
.replaceAll(`hostname="${hostname()}"`, 'hostname="HOSTNAME"')
|
|
||||||
.replaceAll(/file="[^"]*"/g, 'file="*"')
|
|
||||||
.replace(stackTraceBasePath, '$3');
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeWindowsPathEscaping(str) {
|
|
||||||
return common.isWindows ? str.replaceAll(/\\\\/g, '\\') : str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceTestLocationLine(str) {
|
|
||||||
return str.replaceAll(/(js:)(\d+)(:\d+)/g, '$1(LINE)$3');
|
|
||||||
}
|
|
||||||
|
|
||||||
// The Node test coverage returns results for all files called by the test. This
|
|
||||||
// will make the output file change if files like test/common/index.js change.
|
|
||||||
// This transform picks only the first line and then the lines from the test
|
|
||||||
// file.
|
|
||||||
function pickTestFileFromLcov(str) {
|
|
||||||
const lines = str.split(/\n/);
|
|
||||||
const firstLineOfTestFile = lines.findIndex(
|
|
||||||
(line) => line.startsWith('SF:') && line.trim().endsWith('output.js')
|
|
||||||
);
|
|
||||||
const lastLineOfTestFile = lines.findIndex(
|
|
||||||
(line, index) => index > firstLineOfTestFile && line.trim() === 'end_of_record'
|
|
||||||
);
|
|
||||||
return (
|
|
||||||
lines[0] + '\n' + lines.slice(firstLineOfTestFile, lastLineOfTestFile + 1).join('\n') + '\n'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultTransform = snapshot.transform(
|
|
||||||
snapshot.replaceWindowsLineEndings,
|
|
||||||
snapshot.replaceStackTrace,
|
|
||||||
removeWindowsPathEscaping,
|
|
||||||
snapshot.transformProjectRoot(),
|
|
||||||
snapshot.replaceWindowsPaths,
|
|
||||||
replaceTestDuration,
|
|
||||||
replaceTestLocationLine,
|
|
||||||
);
|
|
||||||
const specTransform = snapshot.transform(
|
|
||||||
replaceSpecDuration,
|
|
||||||
snapshot.replaceWindowsLineEndings,
|
|
||||||
snapshot.replaceStackTrace,
|
|
||||||
snapshot.replaceWindowsPaths,
|
|
||||||
);
|
|
||||||
const junitTransform = snapshot.transform(
|
|
||||||
replaceJunitDuration,
|
|
||||||
snapshot.replaceWindowsLineEndings,
|
|
||||||
snapshot.replaceStackTrace,
|
|
||||||
snapshot.replaceWindowsPaths,
|
|
||||||
);
|
|
||||||
const lcovTransform = snapshot.transform(
|
|
||||||
snapshot.replaceWindowsLineEndings,
|
|
||||||
snapshot.replaceStackTrace,
|
|
||||||
snapshot.transformProjectRoot(),
|
|
||||||
snapshot.replaceWindowsPaths,
|
|
||||||
pickTestFileFromLcov
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
const tests = [
|
|
||||||
{ name: 'test-runner/output/abort.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/abort-runs-after-hook.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/abort_suite.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{ name: 'test-runner/output/abort_hooks.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{ name: 'test-runner/output/describe_it.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/describe_nested.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/eval_dot.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/eval_spec.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/eval_tap.js' },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/filtered-suite-delayed-build.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/filtered-suite-order.mjs',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/filtered-suite-throws.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/hooks.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{ name: 'test-runner/output/hooks_spec_reporter.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/skip-each-hooks.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/suite-skip-hooks.js', transform: specTransform },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/timeout_in_before_each_should_not_affect_further_tests.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-timeout-flag.js',
|
|
||||||
flags: [
|
|
||||||
'--test-reporter=tap',
|
|
||||||
'--test-timeout=100',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
// --test-timeout should work with or without --test flag
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-timeout-flag.js',
|
|
||||||
flags: [
|
|
||||||
'--test-reporter=tap',
|
|
||||||
'--test-timeout=100',
|
|
||||||
'--test',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/hooks-with-no-global-test.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/global-hooks-with-no-tests.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/before-and-after-each-too-many-listeners.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/before-and-after-each-with-timeout-too-many-listeners.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/force_exit.js', transform: specTransform },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/global_after_should_fail_the_test.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/no_refs.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/no_tests.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/only_tests.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{ name: 'test-runner/output/dot_reporter.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/junit_reporter.js', transform: junitTransform },
|
|
||||||
{ name: 'test-runner/output/spec_reporter_successful.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/spec_reporter.js', transform: specTransform },
|
|
||||||
{ name: 'test-runner/output/spec_reporter_cli.js', transform: specTransform },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/source_mapped_locations.mjs',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
process.features.inspector ?
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/lcov_reporter.js',
|
|
||||||
transform: lcovTransform
|
|
||||||
} :
|
|
||||||
false,
|
|
||||||
{ name: 'test-runner/output/output.js', flags: ['--test-reporter=tap'] },
|
|
||||||
{ name: 'test-runner/output/output_cli.js' },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/name_and_skip_patterns.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/name_pattern.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/name_pattern_with_only.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/skip_pattern.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/unfinished-suite-async-error.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{ name: 'test-runner/output/default_output.js', transform: specTransform, tty: true },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/arbitrary-output.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/non-tty-forced-color-output.js',
|
|
||||||
transform: specTransform,
|
|
||||||
},
|
|
||||||
canColorize ? {
|
|
||||||
name: 'test-runner/output/assertion-color-tty.mjs',
|
|
||||||
flags: ['--test', '--stack-trace-limit=0'],
|
|
||||||
transform: specTransform,
|
|
||||||
tty: true,
|
|
||||||
} : false,
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/async-test-scheduling.mjs',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
!skipForceColors ? {
|
|
||||||
name: 'test-runner/output/arbitrary-output-colored.js',
|
|
||||||
transform: snapshot.transform(specTransform, replaceTestDuration), tty: true
|
|
||||||
} : false,
|
|
||||||
{ name: 'test-runner/output/dot_output_custom_columns.js', transform: specTransform, tty: true },
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/tap_escape.js',
|
|
||||||
transform: snapshot.transform(
|
|
||||||
snapshot.replaceWindowsLineEndings,
|
|
||||||
replaceTestDuration,
|
|
||||||
),
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-runner-plan.js',
|
|
||||||
flags: ['--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-runner-watch-spec.mjs',
|
|
||||||
transform: specTransform,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-runner-plan-timeout.js',
|
|
||||||
flags: ['--test-reporter=tap', '--test-force-exit'],
|
|
||||||
},
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage_failure.js',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
{
|
|
||||||
name: 'test-runner/output/test-diagnostic-warning-without-test-only-flag.js',
|
|
||||||
flags: ['--test', '--test-reporter=tap'],
|
|
||||||
},
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-40.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-80.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector && !skipCoverageColors ? {
|
|
||||||
name: 'test-runner/output/coverage-width-80-color.mjs',
|
|
||||||
flags: ['--test-coverage-exclude=!test/**'],
|
|
||||||
transform: specTransform,
|
|
||||||
tty: true
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-100.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-150.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-infinity.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-80-uncovered-lines.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-100-uncovered-lines.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector && !skipCoverageColors ? {
|
|
||||||
name: 'test-runner/output/coverage-width-80-uncovered-lines-color.mjs',
|
|
||||||
flags: ['--test-coverage-exclude=!test/**'],
|
|
||||||
transform: specTransform,
|
|
||||||
tty: true
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-150-uncovered-lines.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-width-infinity-uncovered-lines.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'],
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-short-filename.mjs',
|
|
||||||
flags: ['--test-reporter=tap', '--test-coverage-exclude=../output/**'],
|
|
||||||
cwd: fixtures.path('test-runner/coverage-snap'),
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/typescript-coverage.mts',
|
|
||||||
flags: ['--disable-warning=ExperimentalWarning',
|
|
||||||
'--test-reporter=tap',
|
|
||||||
'--experimental-transform-types',
|
|
||||||
'--experimental-test-module-mocks',
|
|
||||||
'--experimental-test-coverage',
|
|
||||||
'--test-coverage-exclude=!test/**']
|
|
||||||
} : false,
|
|
||||||
process.features.inspector ? {
|
|
||||||
name: 'test-runner/output/coverage-with-mock.mjs',
|
|
||||||
flags: ['--disable-warning=ExperimentalWarning',
|
|
||||||
'--test-reporter=tap',
|
|
||||||
'--experimental-transform-types',
|
|
||||||
'--experimental-test-module-mocks',
|
|
||||||
'--experimental-test-coverage',
|
|
||||||
'--test-coverage-exclude=!test/**']
|
|
||||||
} : false,
|
|
||||||
]
|
|
||||||
.filter(Boolean)
|
|
||||||
.map(({ flags, name, tty, transform, cwd }) => ({
|
|
||||||
name,
|
|
||||||
fn: common.mustCall(async () => {
|
|
||||||
await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { tty, flags, cwd });
|
|
||||||
}),
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (cwd() !== root) {
|
|
||||||
chdir(root);
|
|
||||||
}
|
|
||||||
describe('test runner output', { concurrency: true }, () => {
|
|
||||||
for (const { name, fn } of tests) {
|
|
||||||
it(name, fn);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
11
test/test-runner/test-output-abort-hooks.mjs
Normal file
11
test/test-runner/test-output-abort-hooks.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/abort_hooks.js matches test-runner/output/abort_hooks.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/abort_hooks.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-abort-runs-after-hook.mjs
Normal file
12
test/test-runner/test-output-abort-runs-after-hook.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/abort-runs-after-hook.js matches
|
||||||
|
// test-runner/output/abort-runs-after-hook.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/abort-runs-after-hook.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-abort-suite.mjs
Normal file
11
test/test-runner/test-output-abort-suite.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/abort_suite.js matches test-runner/output/abort_suite.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/abort_suite.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-abort.mjs
Normal file
11
test/test-runner/test-output-abort.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/abort.js matches test-runner/output/abort.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/abort.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
27
test/test-runner/test-output-arbitrary-output-colored.mjs
Normal file
27
test/test-runner/test-output-arbitrary-output-colored.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Test that the output of test-runner/output/arbitrary-output-colored.js matches
|
||||||
|
// test-runner/output/arbitrary-output-colored.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import {
|
||||||
|
spawnAndAssert,
|
||||||
|
specTransform,
|
||||||
|
replaceTestDuration,
|
||||||
|
transform,
|
||||||
|
ensureCwdIsProjectRoot,
|
||||||
|
} from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
const skipForceColors =
|
||||||
|
process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' ||
|
||||||
|
process.config.variables.node_shared_openssl;
|
||||||
|
|
||||||
|
if (skipForceColors) {
|
||||||
|
// https://github.com/nodejs/node/pull/48057
|
||||||
|
common.skip('Forced colors not supported in this build');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/arbitrary-output-colored.js'),
|
||||||
|
transform(specTransform, replaceTestDuration),
|
||||||
|
{ tty: true },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-arbitrary-output.mjs
Normal file
12
test/test-runner/test-output-arbitrary-output.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/arbitrary-output.js matches
|
||||||
|
// test-runner/output/arbitrary-output.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/arbitrary-output.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
17
test/test-runner/test-output-assertion-color-tty.mjs
Normal file
17
test/test-runner/test-output-assertion-color-tty.mjs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Flags: --expose-internals
|
||||||
|
// Test that the output of test-runner/output/assertion-color-tty.mjs matches
|
||||||
|
// test-runner/output/assertion-color-tty.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, canColorize, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!canColorize()) {
|
||||||
|
common.skip('TTY colors not supported');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/assertion-color-tty.mjs'),
|
||||||
|
specTransform,
|
||||||
|
{ flags: ['--test', '--stack-trace-limit=0'], tty: true },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-async-test-scheduling.mjs
Normal file
12
test/test-runner/test-output-async-test-scheduling.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/async-test-scheduling.mjs matches
|
||||||
|
// test-runner/output/async-test-scheduling.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/async-test-scheduling.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/before-and-after-each-too-many-listeners.js matches
|
||||||
|
// test-runner/output/before-and-after-each-too-many-listeners.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/before-and-after-each-too-many-listeners.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/before-and-after-each-with-timeout-too-many-listeners.js matches
|
||||||
|
// test-runner/output/before-and-after-each-with-timeout-too-many-listeners.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/before-and-after-each-with-timeout-too-many-listeners.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-failure.mjs
Normal file
16
test/test-runner/test-output-coverage-failure.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage_failure.js matches
|
||||||
|
// test-runner/output/coverage_failure.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage_failure.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
19
test/test-runner/test-output-coverage-short-filename.mjs
Normal file
19
test/test-runner/test-output-coverage-short-filename.mjs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-short-filename.mjs matches
|
||||||
|
// test-runner/output/coverage-short-filename.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-short-filename.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{
|
||||||
|
flags: ['--test-reporter=tap', '--test-coverage-exclude=../output/**'],
|
||||||
|
cwd: fixtures.path('test-runner/coverage-snap'),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-100-uncovered-lines.mjs matches
|
||||||
|
// test-runner/output/coverage-width-100-uncovered-lines.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-100-uncovered-lines.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-width-100.mjs
Normal file
16
test/test-runner/test-output-coverage-width-100.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-100.mjs matches
|
||||||
|
// test-runner/output/coverage-width-100.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-100.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-150-uncovered-lines.mjs matches
|
||||||
|
// test-runner/output/coverage-width-150-uncovered-lines.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-150-uncovered-lines.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-width-150.mjs
Normal file
16
test/test-runner/test-output-coverage-width-150.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-150.mjs matches
|
||||||
|
// test-runner/output/coverage-width-150.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-150.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-width-40.mjs
Normal file
16
test/test-runner/test-output-coverage-width-40.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-40.mjs matches
|
||||||
|
// test-runner/output/coverage-width-40.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-40.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
21
test/test-runner/test-output-coverage-width-80-color.mjs
Normal file
21
test/test-runner/test-output-coverage-width-80-color.mjs
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Flags: --expose-internals
|
||||||
|
// Test that the output of test-runner/output/coverage-width-80-color.mjs matches
|
||||||
|
// test-runner/output/coverage-width-80-color.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, canColorize, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canColorize()) {
|
||||||
|
common.skip('TTY colors not supported');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-80-color.mjs'),
|
||||||
|
specTransform,
|
||||||
|
{ flags: ['--test-coverage-exclude=!test/**'], tty: true },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Flags: --expose-internals
|
||||||
|
// Test that the output of test-runner/output/coverage-width-80-uncovered-lines-color.mjs matches
|
||||||
|
// test-runner/output/coverage-width-80-uncovered-lines-color.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, canColorize, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canColorize()) {
|
||||||
|
common.skip('TTY colors not supported');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-80-uncovered-lines-color.mjs'),
|
||||||
|
specTransform,
|
||||||
|
{ flags: ['--test-coverage-exclude=!test/**'], tty: true },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-80-uncovered-lines.mjs matches
|
||||||
|
// test-runner/output/coverage-width-80-uncovered-lines.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-80-uncovered-lines.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-width-80.mjs
Normal file
16
test/test-runner/test-output-coverage-width-80.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-80.mjs matches
|
||||||
|
// test-runner/output/coverage-width-80.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-80.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-infinity-uncovered-lines.mjs matches
|
||||||
|
// test-runner/output/coverage-width-infinity-uncovered-lines.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-infinity-uncovered-lines.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
16
test/test-runner/test-output-coverage-width-infinity.mjs
Normal file
16
test/test-runner/test-output-coverage-width-infinity.mjs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-width-infinity.mjs matches
|
||||||
|
// test-runner/output/coverage-width-infinity.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-width-infinity.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-coverage-exclude=!test/**'] },
|
||||||
|
);
|
||||||
25
test/test-runner/test-output-coverage-with-mock.mjs
Normal file
25
test/test-runner/test-output-coverage-with-mock.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Test that the output of test-runner/output/coverage-with-mock.mjs matches
|
||||||
|
// test-runner/output/coverage-with-mock.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/coverage-with-mock.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{
|
||||||
|
flags: [
|
||||||
|
'--disable-warning=ExperimentalWarning',
|
||||||
|
'--test-reporter=tap',
|
||||||
|
'--experimental-transform-types',
|
||||||
|
'--experimental-test-module-mocks',
|
||||||
|
'--experimental-test-coverage',
|
||||||
|
'--test-coverage-exclude=!test/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-default-output.mjs
Normal file
11
test/test-runner/test-output-default-output.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/default_output.js matches test-runner/output/default_output.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/default_output.js'),
|
||||||
|
specTransform,
|
||||||
|
{ tty: true },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-describe-it.mjs
Normal file
11
test/test-runner/test-output-describe-it.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/describe_it.js matches test-runner/output/describe_it.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/describe_it.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-describe-nested.mjs
Normal file
11
test/test-runner/test-output-describe-nested.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/describe_nested.js matches test-runner/output/describe_nested.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/describe_nested.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-dot-output-custom-columns.mjs
Normal file
12
test/test-runner/test-output-dot-output-custom-columns.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/dot_output_custom_columns.js matches
|
||||||
|
// test-runner/output/dot_output_custom_columns.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/dot_output_custom_columns.js'),
|
||||||
|
specTransform,
|
||||||
|
{ tty: true },
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-dot-reporter.mjs
Normal file
10
test/test-runner/test-output-dot-reporter.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/dot_reporter.js matches test-runner/output/dot_reporter.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/dot_reporter.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-eval-dot.mjs
Normal file
10
test/test-runner/test-output-eval-dot.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/eval_dot.js matches test-runner/output/eval_dot.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/eval_dot.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-eval-spec.mjs
Normal file
10
test/test-runner/test-output-eval-spec.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/eval_spec.js matches test-runner/output/eval_spec.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/eval_spec.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-eval-tap.mjs
Normal file
10
test/test-runner/test-output-eval-tap.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/eval_tap.js matches test-runner/output/eval_tap.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/eval_tap.js'),
|
||||||
|
defaultTransform,
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/filtered-suite-delayed-build.js matches
|
||||||
|
// test-runner/output/filtered-suite-delayed-build.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/filtered-suite-delayed-build.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-filtered-suite-order.mjs
Normal file
12
test/test-runner/test-output-filtered-suite-order.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/filtered-suite-order.mjs matches
|
||||||
|
// test-runner/output/filtered-suite-order.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/filtered-suite-order.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-filtered-suite-throws.mjs
Normal file
12
test/test-runner/test-output-filtered-suite-throws.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/filtered-suite-throws.js matches
|
||||||
|
// test-runner/output/filtered-suite-throws.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/filtered-suite-throws.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-force-exit.mjs
Normal file
10
test/test-runner/test-output-force-exit.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/force_exit.js matches test-runner/output/force_exit.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/force_exit.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/global_after_should_fail_the_test.js matches
|
||||||
|
// test-runner/output/global_after_should_fail_the_test.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/global_after_should_fail_the_test.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-global-hooks-with-no-tests.mjs
Normal file
12
test/test-runner/test-output-global-hooks-with-no-tests.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/global-hooks-with-no-tests.js matches
|
||||||
|
// test-runner/output/global-hooks-with-no-tests.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/global-hooks-with-no-tests.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-hooks-spec-reporter.mjs
Normal file
11
test/test-runner/test-output-hooks-spec-reporter.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/hooks_spec_reporter.js matches
|
||||||
|
// test-runner/output/hooks_spec_reporter.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/hooks_spec_reporter.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-hooks-with-no-global-test.mjs
Normal file
12
test/test-runner/test-output-hooks-with-no-global-test.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/hooks-with-no-global-test.js matches
|
||||||
|
// test-runner/output/hooks-with-no-global-test.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/hooks-with-no-global-test.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-hooks.mjs
Normal file
11
test/test-runner/test-output-hooks.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/hooks.js matches test-runner/output/hooks.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/hooks.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-junit-reporter.mjs
Normal file
11
test/test-runner/test-output-junit-reporter.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/junit_reporter.js matches
|
||||||
|
// test-runner/output/junit_reporter.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, junitTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/junit_reporter.js'),
|
||||||
|
junitTransform,
|
||||||
|
);
|
||||||
14
test/test-runner/test-output-lcov-reporter.mjs
Normal file
14
test/test-runner/test-output-lcov-reporter.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
// Test that the output of test-runner/output/lcov_reporter.js matches test-runner/output/lcov_reporter.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, lcovTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/lcov_reporter.js'),
|
||||||
|
lcovTransform,
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-name-and-skip-patterns.mjs
Normal file
12
test/test-runner/test-output-name-and-skip-patterns.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/name_and_skip_patterns.js matches
|
||||||
|
// test-runner/output/name_and_skip_patterns.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/name_and_skip_patterns.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-name-pattern-with-only.mjs
Normal file
12
test/test-runner/test-output-name-pattern-with-only.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/name_pattern_with_only.js matches
|
||||||
|
// test-runner/output/name_pattern_with_only.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/name_pattern_with_only.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-name-pattern.mjs
Normal file
11
test/test-runner/test-output-name-pattern.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/name_pattern.js matches test-runner/output/name_pattern.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/name_pattern.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-no-refs.mjs
Normal file
11
test/test-runner/test-output-no-refs.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/no_refs.js matches test-runner/output/no_refs.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/no_refs.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-no-tests.mjs
Normal file
11
test/test-runner/test-output-no-tests.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/no_tests.js matches test-runner/output/no_tests.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/no_tests.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-non-tty-forced-color-output.mjs
Normal file
11
test/test-runner/test-output-non-tty-forced-color-output.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/non-tty-forced-color-output.js matches
|
||||||
|
// test-runner/output/non-tty-forced-color-output.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/non-tty-forced-color-output.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-only-tests.mjs
Normal file
11
test/test-runner/test-output-only-tests.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/only_tests.js matches test-runner/output/only_tests.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/only_tests.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-output-cli.mjs
Normal file
10
test/test-runner/test-output-output-cli.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/output_cli.js matches test-runner/output/output_cli.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/output_cli.js'),
|
||||||
|
defaultTransform,
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-output.mjs
Normal file
11
test/test-runner/test-output-output.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/output.js matches test-runner/output/output.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/output.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-skip-each-hooks.mjs
Normal file
11
test/test-runner/test-output-skip-each-hooks.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/skip-each-hooks.js matches
|
||||||
|
// test-runner/output/skip-each-hooks.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/skip-each-hooks.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-skip-pattern.mjs
Normal file
11
test/test-runner/test-output-skip-pattern.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/skip_pattern.js matches test-runner/output/skip_pattern.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/skip_pattern.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-source-mapped-locations.mjs
Normal file
12
test/test-runner/test-output-source-mapped-locations.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/source_mapped_locations.mjs matches
|
||||||
|
// test-runner/output/source_mapped_locations.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/source_mapped_locations.mjs'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-spec-reporter-cli.mjs
Normal file
11
test/test-runner/test-output-spec-reporter-cli.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/spec_reporter_cli.js matches
|
||||||
|
// test-runner/output/spec_reporter_cli.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/spec_reporter_cli.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-spec-reporter-successful.mjs
Normal file
11
test/test-runner/test-output-spec-reporter-successful.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/spec_reporter_successful.js matches
|
||||||
|
// test-runner/output/spec_reporter_successful.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/spec_reporter_successful.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
10
test/test-runner/test-output-spec-reporter.mjs
Normal file
10
test/test-runner/test-output-spec-reporter.mjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Test that the output of test-runner/output/spec_reporter.js matches test-runner/output/spec_reporter.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/spec_reporter.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-suite-skip-hooks.mjs
Normal file
11
test/test-runner/test-output-suite-skip-hooks.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/suite-skip-hooks.js matches
|
||||||
|
// test-runner/output/suite-skip-hooks.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/suite-skip-hooks.js'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
17
test/test-runner/test-output-tap-escape.mjs
Normal file
17
test/test-runner/test-output-tap-escape.mjs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Test that the output of test-runner/output/tap_escape.js matches test-runner/output/tap_escape.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import {
|
||||||
|
spawnAndAssert,
|
||||||
|
transform,
|
||||||
|
replaceWindowsLineEndings,
|
||||||
|
replaceTestDuration,
|
||||||
|
ensureCwdIsProjectRoot,
|
||||||
|
} from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/tap_escape.js'),
|
||||||
|
transform(replaceWindowsLineEndings, replaceTestDuration),
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/test-diagnostic-warning-without-test-only-flag.js matches
|
||||||
|
// test-runner/output/test-diagnostic-warning-without-test-only-flag.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-diagnostic-warning-without-test-only-flag.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test', '--test-reporter=tap'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-test-runner-plan-timeout.mjs
Normal file
12
test/test-runner/test-output-test-runner-plan-timeout.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/test-runner-plan-timeout.js matches
|
||||||
|
// test-runner/output/test-runner-plan-timeout.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-runner-plan-timeout.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-force-exit'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-test-runner-plan.mjs
Normal file
12
test/test-runner/test-output-test-runner-plan.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/test-runner-plan.js matches
|
||||||
|
// test-runner/output/test-runner-plan.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-runner-plan.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
11
test/test-runner/test-output-test-runner-watch-spec.mjs
Normal file
11
test/test-runner/test-output-test-runner-watch-spec.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Test that the output of test-runner/output/test-runner-watch-spec.mjs matches
|
||||||
|
// test-runner/output/test-runner-watch-spec.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, specTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-runner-watch-spec.mjs'),
|
||||||
|
specTransform,
|
||||||
|
);
|
||||||
13
test/test-runner/test-output-test-timeout-flag-with-test.mjs
Normal file
13
test/test-runner/test-output-test-timeout-flag-with-test.mjs
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Test that the output of test-runner/output/test-timeout-flag.js matches
|
||||||
|
// test-runner/output/test-timeout-flag.snapshot with --test flag.
|
||||||
|
// --test-timeout should work with or without --test flag.
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-timeout-flag.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-timeout=100', '--test'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-test-timeout-flag.mjs
Normal file
12
test/test-runner/test-output-test-timeout-flag.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/test-timeout-flag.js matches
|
||||||
|
// test-runner/output/test-timeout-flag.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/test-timeout-flag.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap', '--test-timeout=100'] },
|
||||||
|
);
|
||||||
12
test/test-runner/test-output-timeout-in-before-each.mjs
Normal file
12
test/test-runner/test-output-timeout-in-before-each.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/timeout_in_before_each_should_not_affect_further_tests.js matches
|
||||||
|
// test-runner/output/timeout_in_before_each_should_not_affect_further_tests.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/timeout_in_before_each_should_not_affect_further_tests.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
25
test/test-runner/test-output-typescript-coverage.mjs
Normal file
25
test/test-runner/test-output-typescript-coverage.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Test that the output of test-runner/output/typescript-coverage.mts matches
|
||||||
|
// test-runner/output/typescript-coverage.snapshot
|
||||||
|
import * as common from '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
if (!process.features.inspector) {
|
||||||
|
common.skip('inspector support required');
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/typescript-coverage.mts'),
|
||||||
|
defaultTransform,
|
||||||
|
{
|
||||||
|
flags: [
|
||||||
|
'--disable-warning=ExperimentalWarning',
|
||||||
|
'--test-reporter=tap',
|
||||||
|
'--experimental-transform-types',
|
||||||
|
'--experimental-test-module-mocks',
|
||||||
|
'--experimental-test-coverage',
|
||||||
|
'--test-coverage-exclude=!test/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Test that the output of test-runner/output/unfinished-suite-async-error.js matches
|
||||||
|
// test-runner/output/unfinished-suite-async-error.snapshot
|
||||||
|
import '../common/index.mjs';
|
||||||
|
import * as fixtures from '../common/fixtures.mjs';
|
||||||
|
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
|
||||||
|
|
||||||
|
ensureCwdIsProjectRoot();
|
||||||
|
await spawnAndAssert(
|
||||||
|
fixtures.path('test-runner/output/unfinished-suite-async-error.js'),
|
||||||
|
defaultTransform,
|
||||||
|
{ flags: ['--test-reporter=tap'] },
|
||||||
|
);
|
||||||
7
test/test-runner/test-runner.status
Normal file
7
test/test-runner/test-runner.status
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
prefix test-runner
|
||||||
|
|
||||||
|
# To mark a test as flaky, list the test name in the appropriate section
|
||||||
|
# below, without ".js", followed by ": PASS,FLAKY". Example:
|
||||||
|
# sample-test : PASS,FLAKY
|
||||||
|
|
||||||
|
[true] # This section applies to all platforms
|
||||||
6
test/test-runner/testcfg.py
Normal file
6
test/test-runner/testcfg.py
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import sys, os
|
||||||
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
import testpy
|
||||||
|
|
||||||
|
def GetConfiguration(context, root):
|
||||||
|
return testpy.ParallelTestConfiguration(context, root, 'test-runner')
|
||||||
Loading…
Reference in New Issue
Block a user