diff --git a/test/common/index.js b/test/common/index.js index 18215f88b4186f..03bb1bed5c650b 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -1151,6 +1151,15 @@ const common = { get checkoutEOL() { return fs.readFileSync(__filename).includes('\r\n') ? '\r\n' : '\n'; }, + + get isInsideCWDWithUnusualChars() { + const cwd = process.cwd(); + return cwd.includes('%') || + (!isWindows && cwd.includes('\\')) || + cwd.includes('\n') || + cwd.includes('\r') || + cwd.includes('\t'); + }, }; const validProperties = new Set(Object.keys(common)); diff --git a/test/parallel/test-fs-cp.mjs b/test/parallel/test-fs-cp.mjs index 63bc813ae226c7..38c7c5bdff6d3b 100644 --- a/test/parallel/test-fs-cp.mjs +++ b/test/parallel/test-fs-cp.mjs @@ -1,4 +1,4 @@ -import { mustCall, mustNotMutateObjectDeep } from '../common/index.mjs'; +import { mustCall, mustNotMutateObjectDeep, isInsideCWDWithUnusualChars } from '../common/index.mjs'; import assert from 'assert'; import fs from 'fs'; @@ -306,7 +306,7 @@ function nextdir() { } // It throws an error if attempt is made to copy socket. -if (!isWindows) { +if (!isWindows && !isInsideCWDWithUnusualChars) { const src = nextdir(); mkdirSync(src); const dest = nextdir(); diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 822ac268894230..9f79ce1017c81c 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -2,6 +2,8 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); +if (common.isInsideCWDWithUnusualChars) + common.skip('npm does not support this install path'); const path = require('path'); const exec = require('child_process').exec; diff --git a/test/parallel/test-startup-empty-regexp-statics.js b/test/parallel/test-startup-empty-regexp-statics.js index 5744bbc14bba21..65081cc81bbe3d 100644 --- a/test/parallel/test-startup-empty-regexp-statics.js +++ b/test/parallel/test-startup-empty-regexp-statics.js @@ -66,7 +66,7 @@ const allRegExpStatics = assert.strictEqual(child.signal, null); } -{ +if (!common.isInsideCWDWithUnusualChars) { const child = spawn(process.execPath, [], { stdio: ['pipe', 'pipe', 'inherit'], encoding: 'utf8' }); let stdout = '';