diff options
author | Gar <gar+gh@danger.computer> | 2022-10-05 20:51:56 +0300 |
---|---|---|
committer | Gar <wraithgar@github.com> | 2022-10-05 21:32:08 +0300 |
commit | 9f8e3f09654d9792e42c5cc7bb3664b6afea8852 (patch) | |
tree | 97e3212540c7a331e446ede85c639f11420f7094 | |
parent | 9e3a823aeac53797c30bce837e41ae32260bd199 (diff) |
chore: simplify foregroundScripts test
-rw-r--r-- | workspaces/libnpmpack/test/fixtures/tspawk.js | 1 | ||||
-rw-r--r-- | workspaces/libnpmpack/test/index.js | 7 |
2 files changed, 3 insertions, 5 deletions
diff --git a/workspaces/libnpmpack/test/fixtures/tspawk.js b/workspaces/libnpmpack/test/fixtures/tspawk.js index 6c1b481c8..554a9d402 100644 --- a/workspaces/libnpmpack/test/fixtures/tspawk.js +++ b/workspaces/libnpmpack/test/fixtures/tspawk.js @@ -5,6 +5,7 @@ const spawk = require('spawk') module.exports = tspawk function tspawk (t) { + spawk.preventUnmatched() t.teardown(function () { spawk.unload() }) diff --git a/workspaces/libnpmpack/test/index.js b/workspaces/libnpmpack/test/index.js index acbdfd947..fb50e197b 100644 --- a/workspaces/libnpmpack/test/index.js +++ b/workspaces/libnpmpack/test/index.js @@ -3,13 +3,11 @@ const t = require('tap') const tspawk = require('./fixtures/tspawk.js') -const spawk = tspawk(t) const fs = require('fs') const path = require('path') const pack = require('../lib/index.js') const tnock = require('./fixtures/tnock.js') -const { load: loadMockNpm } = require('../../../test/fixtures/mock-npm.js') const OPTS = { registry: 'https://mock.reg/', @@ -140,7 +138,7 @@ t.test('packs from registry spec', async t => { }) t.test('runs scripts in foreground when foregroundScripts === true', async t => { - const { npm } = await loadMockNpm(t, {}) + const spawk = tspawk(t) const testDir = t.testdir({ 'package.json': JSON.stringify({ @@ -148,7 +146,6 @@ t.test('runs scripts in foreground when foregroundScripts === true', async t => version: '1.0.0', scripts: { prepack: 'touch prepack', - postpack: 'touch postpack', }, }, null, 2), }) @@ -158,7 +155,7 @@ t.test('runs scripts in foreground when foregroundScripts === true', async t => const [scriptShell, scriptArgs] = makeSpawnArgs({ event: 'prepack', - path: npm.prefix, + path: testDir, cmd: 'touch prepack', }) |