diff options
author | nlf <quitlahok@gmail.com> | 2022-06-21 23:50:10 +0300 |
---|---|---|
committer | Nathan Fritz <fritzy@github.com> | 2022-06-22 23:46:13 +0300 |
commit | 3e28f3ccd5d09c9c2a1036cd4cd98571ac737808 (patch) | |
tree | c24eb5b0fd2c8eee2b7f60a0fb905554d53e294b /workspaces/arborist/test | |
parent | 2c06ceee82dd813c0ae84cc0b09e6941cfc5533e (diff) |
chore(tests): fix tests for @npmcli/run-script@4.1.0 update
Diffstat (limited to 'workspaces/arborist/test')
-rw-r--r-- | workspaces/arborist/test/arborist/rebuild.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/workspaces/arborist/test/arborist/rebuild.js b/workspaces/arborist/test/arborist/rebuild.js index 37551c748..cac811aac 100644 --- a/workspaces/arborist/test/arborist/rebuild.js +++ b/workspaces/arborist/test/arborist/rebuild.js @@ -2,6 +2,7 @@ const t = require('tap') const _trashList = Symbol.for('trashList') const Arborist = require('../../lib/arborist/index.js') const { resolve, dirname } = require('path') +const os = require('os') const fs = require('fs') const fixtures = resolve(__dirname, '../fixtures') const relpath = require('../../lib/relpath.js') @@ -185,6 +186,11 @@ t.test('verify dep flags in script environments', async t => { localeCompare(patha, pathb) || localeCompare(eventa, eventb)) .map(({ pkg, event, cmd, code, signal, stdout, stderr }) => ({ pkg, event, cmd, code, signal, stdout, stderr })) + t.cleanSnapshot = (input) => { + return input.replace(new RegExp(os.tmpdir().replace(/\\/g, '\\\\\\\\'), 'g'), '{TMP}') + .replace(/\\\\/g, '/') + .replace(/(\d+)\.(?:sh|cmd)/g, '{TIMESTAMP}') + } t.matchSnapshot(saved, 'saved script results') for (const [pkg, flags] of Object.entries(expect)) { |