diff options
author | nlf <quitlahok@gmail.com> | 2022-06-02 20:58:02 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2022-06-02 20:58:02 +0300 |
commit | 53a6ded849b61e7a96f7794d8c98984b0277bd9c (patch) | |
tree | 5a467801363af16a1c0f45fbfdf10899759cf805 | |
parent | b46fed75379979a6be86ac72117a90f8ad3b3a99 (diff) |
chore(tests): fix libnpmdiff tests for execPaths with spacesnlf/fix-libnpmdiff-tests
-rw-r--r-- | workspaces/libnpmdiff/test/index.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/workspaces/libnpmdiff/test/index.js b/workspaces/libnpmdiff/test/index.js index 6f6e481f5..cccde429b 100644 --- a/workspaces/libnpmdiff/test/index.js +++ b/workspaces/libnpmdiff/test/index.js @@ -5,11 +5,12 @@ const t = require('tap') const diff = require('../lib/index.js') const normalizePath = p => p - .replace(/\\+/g, '/') + .replace(/\\+(?!")/g, '/') .replace(/\r\n/g, '\n') t.cleanSnapshot = (str) => normalizePath(str) .replace(normalizePath(process.execPath), 'node') + .replace(/\\"node\\"/g, 'node') const json = (obj) => `${JSON.stringify(obj, null, 2)}\n` @@ -62,7 +63,7 @@ t.test('folder in node_modules', async t => { name: 'a', version: '1.0.0', scripts: { - prepare: `${process.execPath} prepare.js`, + prepare: `"${process.execPath}" prepare.js`, }, }), 'prepare.js': 'throw new Error("ERR")', @@ -72,7 +73,7 @@ t.test('folder in node_modules', async t => { name: 'b', version: '2.0.0', scripts: { - prepare: `${process.execPath} prepare.js`, + prepare: `"${process.execPath}" prepare.js`, }, }), 'prepare.js': 'throw new Error("ERR")', @@ -86,7 +87,7 @@ t.test('folder in node_modules', async t => { name: 'a', version: '1.0.1', scripts: { - prepare: `${process.execPath} prepare.js`, + prepare: `"${process.execPath}" prepare.js`, }, }), 'prepare.js': '', @@ -96,7 +97,7 @@ t.test('folder in node_modules', async t => { name: 'b', version: '2.0.1', scripts: { - prepare: `${process.execPath} prepare.js`, + prepare: `"${process.execPath}" prepare.js`, }, }), 'prepare.js': '', |