diff --git a/test/path-reservations.js b/test/path-reservations.js index 352fe64f..e73f7431 100644 --- a/test/path-reservations.js +++ b/test/path-reservations.js @@ -3,11 +3,15 @@ const t = require('tap') // load up the posix and windows versions of the reserver if (process.platform === 'win32') process.env.TESTING_TAR_FAKE_PLATFORM = 'posix' -const { reserve } = require('../lib/path-reservations.js')() +const { reserve } = t.mock('../lib/path-reservations.js', { + path: require('path').posix, +})() delete process.env.TESTING_TAR_FAKE_PLATFORM if (process.platform !== 'win32') process.env.TESTING_TAR_FAKE_PLATFORM = 'win32' -const { reserve: winReserve } = t.mock('../lib/path-reservations.js')() +const { reserve: winReserve } = t.mock('../lib/path-reservations.js', { + path: require('path').win32, +})() t.test('basic race', t => { // simulate the race conditions we care about