From a6f88be79dcbc520f812e5879adc3cbe5cecdae8 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Sun, 30 Jun 2024 14:20:25 -0700 Subject: [PATCH 1/3] test: fix embedding test for Windows --- test/common/child_process.js | 4 ++++ test/embedding/test-embedding.js | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/common/child_process.js b/test/common/child_process.js index d555d09a944c1c..192accd4d4f82a 100644 --- a/test/common/child_process.js +++ b/test/common/child_process.js @@ -3,6 +3,7 @@ const assert = require('assert'); const { spawnSync, execFileSync } = require('child_process'); const common = require('./'); +const os = require('os'); const util = require('util'); // Workaround for Windows Server 2008R2 @@ -43,6 +44,9 @@ function logAfterTime(time) { } function checkOutput(str, check) { + if (common.isWindows && typeof str === 'string') { + str = str.replaceAll(os.EOL, '\n'); + } if ((check instanceof RegExp && !check.test(str)) || (typeof check === 'string' && check !== str)) { return { passed: false, reason: `did not match ${util.inspect(check)}` }; diff --git a/test/embedding/test-embedding.js b/test/embedding/test-embedding.js index 5f706eb5666dd0..1a579a11edc8b6 100644 --- a/test/embedding/test-embedding.js +++ b/test/embedding/test-embedding.js @@ -152,12 +152,6 @@ for (const extraSnapshotArgs of [ { cwd: tmpdir.path }); } -// Skipping rest of the test on Windows because it fails in the CI -// TODO(StefanStojanovic): Reenable rest of the test after fixing it -if (common.isWindows) { - return; -} - // Guarantee NODE_REPL_EXTERNAL_MODULE won't bypass kDisableNodeOptionsEnv { spawnSyncAndExit( From 475e8707beeda992519a5ca084cfb6466948c62a Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Sat, 10 Aug 2024 14:04:37 -0700 Subject: [PATCH 2/3] normalize the check string EOL in checkOutput --- test/common/child_process.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/common/child_process.js b/test/common/child_process.js index 192accd4d4f82a..a3dc0639875c9a 100644 --- a/test/common/child_process.js +++ b/test/common/child_process.js @@ -45,7 +45,11 @@ function logAfterTime(time) { function checkOutput(str, check) { if (common.isWindows && typeof str === 'string') { + // Normalize the line endings for the output and the check strings. str = str.replaceAll(os.EOL, '\n'); + if (typeof check === 'string') { + check = check.replaceAll(os.EOL, '\n'); + } } if ((check instanceof RegExp && !check.test(str)) || (typeof check === 'string' && check !== str)) { From d8314e9db9fab253abeffb81a937954471059ae5 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Sun, 11 Aug 2024 08:27:14 -0700 Subject: [PATCH 3/3] rollback changes to test/common/child_process.js --- test/common/child_process.js | 8 -------- test/embedding/test-embedding.js | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/test/common/child_process.js b/test/common/child_process.js index a3dc0639875c9a..d555d09a944c1c 100644 --- a/test/common/child_process.js +++ b/test/common/child_process.js @@ -3,7 +3,6 @@ const assert = require('assert'); const { spawnSync, execFileSync } = require('child_process'); const common = require('./'); -const os = require('os'); const util = require('util'); // Workaround for Windows Server 2008R2 @@ -44,13 +43,6 @@ function logAfterTime(time) { } function checkOutput(str, check) { - if (common.isWindows && typeof str === 'string') { - // Normalize the line endings for the output and the check strings. - str = str.replaceAll(os.EOL, '\n'); - if (typeof check === 'string') { - check = check.replaceAll(os.EOL, '\n'); - } - } if ((check instanceof RegExp && !check.test(str)) || (typeof check === 'string' && check !== str)) { return { passed: false, reason: `did not match ${util.inspect(check)}` }; diff --git a/test/embedding/test-embedding.js b/test/embedding/test-embedding.js index 1a579a11edc8b6..71c4f7f324c973 100644 --- a/test/embedding/test-embedding.js +++ b/test/embedding/test-embedding.js @@ -10,6 +10,7 @@ const { } = require('../common/child_process'); const path = require('path'); const fs = require('fs'); +const os = require('os'); tmpdir.refresh(); common.allowGlobals(global.require); @@ -166,6 +167,6 @@ for (const extraSnapshotArgs of [ { status: 9, signal: null, - stderr: `${binary}: NODE_REPL_EXTERNAL_MODULE can't be used with kDisableNodeOptionsEnv\n`, + stderr: `${binary}: NODE_REPL_EXTERNAL_MODULE can't be used with kDisableNodeOptionsEnv${os.EOL}`, }); }