From 16f29b3887edc41becb0341c27502db1cb637fdd Mon Sep 17 00:00:00 2001 From: jspades93 Date: Fri, 27 Oct 2023 00:42:50 -0500 Subject: [PATCH 1/2] test: migrate message v8 tests from Python to JS --- test/{message => fixtures/v8}/v8_warning.js | 2 +- .../v8/v8_warning.snapshot} | 0 test/parallel/test-node-output-v8-warning.mjs | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) rename test/{message => fixtures/v8}/v8_warning.js (89%) rename test/{message/v8_warning.out => fixtures/v8/v8_warning.snapshot} (100%) create mode 100644 test/parallel/test-node-output-v8-warning.mjs diff --git a/test/message/v8_warning.js b/test/fixtures/v8/v8_warning.js similarity index 89% rename from test/message/v8_warning.js rename to test/fixtures/v8/v8_warning.js index d7d1c5e7dbdff6..ab4d2bf305823f 100644 --- a/test/message/v8_warning.js +++ b/test/fixtures/v8/v8_warning.js @@ -1,6 +1,6 @@ 'use strict'; -require('../common'); +require('../../common'); function AsmModule() { 'use asm'; diff --git a/test/message/v8_warning.out b/test/fixtures/v8/v8_warning.snapshot similarity index 100% rename from test/message/v8_warning.out rename to test/fixtures/v8/v8_warning.snapshot diff --git a/test/parallel/test-node-output-v8-warning.mjs b/test/parallel/test-node-output-v8-warning.mjs new file mode 100644 index 00000000000000..21ccebefce6a71 --- /dev/null +++ b/test/parallel/test-node-output-v8-warning.mjs @@ -0,0 +1,30 @@ +import '../common/index.mjs'; +import * as fixtures from '../common/fixtures.mjs'; +import * as snapshot from '../common/assertSnapshot.js'; +import { describe, it } from 'node:test'; + +function replaceNodeVersion(str) { + return str.replaceAll(process.version, '*'); +} + +describe('v8 output', { concurrency: true }, () => { + function normalize(str) { + return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '') + .replaceAll(/:\d+/g, ':*') + .replaceAll('/', '*') + .replaceAll('*test*', '*') + .replaceAll('*fixtures*v8*', '*') + .replaceAll('node --', '* --'); + } + const common = snapshot + .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion); + const defaultTransform = snapshot.transform(common, normalize); + const tests = [ + { name: 'v8/v8_warning.js' }, + ]; + for (const { name, transform } of tests) { + it(name, async () => { + await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform); + }); + } +}); From dd8a959a24b5da2fbf2036104383af5aeb1350be Mon Sep 17 00:00:00 2001 From: jspades93 Date: Fri, 27 Oct 2023 09:41:02 -0500 Subject: [PATCH 2/2] Cleaned up parallel/test-node-output-v8-warning.mjs --- test/parallel/test-node-output-v8-warning.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-node-output-v8-warning.mjs b/test/parallel/test-node-output-v8-warning.mjs index 21ccebefce6a71..7278a03ce178e7 100644 --- a/test/parallel/test-node-output-v8-warning.mjs +++ b/test/parallel/test-node-output-v8-warning.mjs @@ -22,9 +22,9 @@ describe('v8 output', { concurrency: true }, () => { const tests = [ { name: 'v8/v8_warning.js' }, ]; - for (const { name, transform } of tests) { + for (const { name } of tests) { it(name, async () => { - await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform); + await snapshot.spawnAndAssert(fixtures.path(name), defaultTransform); }); } });