Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Apr 10, 2024
1 parent 3e11c21 commit 6c2bff9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/commands/serve.spec.ts
Expand Up @@ -337,4 +337,22 @@ test.group('Serve command', () => {
await command.exec()
await sleep(1200)
})

test('error if --hmr and --watch are used together', async ({ assert, fs, cleanup }) => {

Check failure on line 341 in tests/commands/serve.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck / typecheck

'cleanup' is declared but its value is never read.

Check failure on line 341 in tests/commands/serve.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck / typecheck

'cleanup' is declared but its value is never read.
await fs.create('node_modules/ts-node/esm.js', '')

const ace = await new AceFactory().make(fs.baseUrl, {
importer: (filePath) => import(filePath),
})

ace.ui.switchMode('raw')

const command = await ace.create(Serve, ['--hmr', '--watch', '--no-clear'])
await command.exec()

assert.equal(command.exitCode, 1)
assert.lengthOf(ace.ui.logger.getLogs(), 1)
assert.equal(ace.ui.logger.getLogs()[0].stream, 'stderr')
assert.match(ace.ui.logger.getLogs()[0].message, /Cannot use --watch and --hmr flags together/)
})
})

0 comments on commit 6c2bff9

Please sign in to comment.