Skip to content

Commit

Permalink
Fix tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 21, 2023
1 parent 1e3b3dc commit 755d1cf
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ test('args', async function (t) {
await t.test('should support `--watch`', async function () {
// On Windows, `SIGINT` crashes immediately and results in an error.
// Hence `reject: false`, `exitCode`, and extra lines when non-windows.
const delay = 1000
const delay = 3000
const url = new URL('watch.txt', base)

await fs.writeFile(url, 'alpha')
Expand All @@ -690,11 +690,14 @@ test('args', async function (t) {

const lines = [
'Watching... (press CTRL+C to exit)',
'watch.txt: no issues found',
'watch.txt: no issues found'
]

if (platform !== 'win32') {
lines.push('watch.txt: no issues found', '')
if (platform === 'win32') {
// Empty.
} else {
lines.push('')
}

assert.equal(result.exitCode, platform === 'win32' ? undefined : 0)
Expand All @@ -712,7 +715,7 @@ test('args', async function (t) {
})

await t.test('should not regenerate when watching', async function () {
const delay = 1000
const delay = 3000
const url = new URL('watch.txt', base)

await fs.writeFile(url, 'alpha')
Expand All @@ -728,11 +731,12 @@ test('args', async function (t) {
const lines = [
'Watching... (press CTRL+C to exit)',
'Note: Ignoring `--output` until exit.',
'watch.txt: no issues found',
'watch.txt: no issues found'
]

if (platform !== 'win32') {
lines.push('watch.txt: no issues found', '', 'watch.txt: written')
lines.push('', 'watch.txt: written')
}

assert.equal(result.exitCode, platform === 'win32' ? undefined : 0)
Expand Down

0 comments on commit 755d1cf

Please sign in to comment.