Skip to content

Commit

Permalink
Fix failing tests due to changes in Node.js (#34)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina authored May 21, 2024
1 parent ed43793 commit 0fd4d5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions test-utils/clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ let clock

if (process.argv[1].endsWith('borp.js')) {
clock = FakeTimers.install({
node: Date.now(),
now: Date.now(),
shouldAdvanceTime: true,
advanceTimeDelta: 100
advanceTimeDelta: 100,
toFake: ['Date', 'setTimeout', 'clearTimeout']
})
process.on('message', listener)
}
Expand Down
8 changes: 4 additions & 4 deletions test/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('watch', async (t) => {

const fn = (test) => {
if (test.type === 'test:fail') {
strictEqual(test.data.name, 'add')
match(test.data.name, /add/)
stream.removeListener('data', fn)
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ test('watch file syntax error', async (t) => {

const fn = (test) => {
if (test.type === 'test:fail') {
match(test.data.name, /add\.test\.ts/)
match(test.data.name, /add/)
stream.removeListener('data', fn)
}
}
Expand All @@ -111,7 +111,7 @@ test('add', () => {
})

test('watch with post compile hook should call the hook the right number of times', async (t) => {
const { strictEqual, completed, ok } = tspl(t, { plan: 2 })
const { completed, ok, match } = tspl(t, { plan: 2 })

const dir = path.resolve(await mkdtemp('.test-watch-with-post-compile-hook'))
await cp(join(import.meta.url, '..', 'fixtures', 'ts-esm-post-compile'), dir, {
Expand All @@ -138,7 +138,7 @@ test('watch with post compile hook should call the hook the right number of time

const fn = (test) => {
if (test.type === 'test:fail') {
strictEqual(test.data.name, 'add')
match(test.data.name, /add/)
stream.removeListener('data', fn)
}
}
Expand Down

0 comments on commit 0fd4d5d

Please sign in to comment.