Skip to content

Commit

Permalink
fix(test): use posix path for testing path reservations
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 19, 2021
1 parent e5a223c commit 24b8bda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/path-reservations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24b8bda

Please sign in to comment.