Skip to content

Commit 1d9048c

Browse files
committed
test: commented test
1 parent a7488dd commit 1d9048c

1 file changed

Lines changed: 71 additions & 70 deletions

File tree

test/start.test.js

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -566,76 +566,77 @@ test('should start the server listening on 0.0.0.0 when running in kubernetes',
566566
t.assert.ok('server closed')
567567
})
568568

569-
test('should start the server with watch options that the child process restart when directory changed', { skip: true }, async (t) => {
570-
t.plan(3)
571-
const tmpjs = path.resolve(baseFilename + '.js')
572-
573-
const port = getPort()
574-
575-
await writeFile(tmpjs, 'hello world')
576-
const argv = ['-p', port, '-w', './examples/plugin.js']
577-
const fastifyEmitter = await start.start(argv)
578-
579-
t.after(async () => {
580-
if (fs.existsSync(tmpjs)) {
581-
fs.unlinkSync(tmpjs)
582-
}
583-
await fastifyEmitter.stop()
584-
})
585-
586-
await once(fastifyEmitter, 'ready')
587-
t.assert.ok('should receive ready event')
588-
589-
const restartPromise = once(fastifyEmitter, 'restart')
590-
await writeFile(tmpjs, 'hello fastify', { flag: 'a+' }) // chokidar watch can't catch change event in CI, but local test is all ok. you can remove annotation in local environment.
591-
t.assert.ok('change tmpjs')
592-
593-
// this might happen more than once but does not matter in this context
594-
await restartPromise
595-
t.assert.ok('should receive restart event')
596-
})
597-
598-
test('should start the server with watch and verbose-watch options that the child process restart when directory changed with console message about changes ', { skip: true }, async (t) => {
599-
t.plan(4)
600-
601-
const spy = sinon.spy()
602-
const watch = proxyquire('../lib/watch', {
603-
'./utils': {
604-
logWatchVerbose: spy
605-
}
606-
})
607-
608-
const start = proxyquire('../start', {
609-
'./lib/watch': watch
610-
})
611-
612-
const tmpjs = path.resolve(baseFilename + '.js')
613-
614-
const port = getPort()
615-
616-
await writeFile(tmpjs, 'hello world')
617-
const argv = ['-p', port, '-w', '--verbose-watch', './examples/plugin.js']
618-
const fastifyEmitter = await start.start(argv)
619-
620-
t.after(async () => {
621-
if (fs.existsSync(tmpjs)) {
622-
fs.unlinkSync(tmpjs)
623-
}
624-
await fastifyEmitter.stop()
625-
})
626-
627-
await once(fastifyEmitter, 'ready')
628-
t.assert.ok('should receive ready event')
629-
630-
const restartPromise = once(fastifyEmitter, 'restart')
631-
await writeFile(tmpjs, 'hello fastify', { flag: 'a+' }) // chokidar watch can't catch change event in CI, but local test is all ok. you can remove annotation in local environment.
632-
t.assert.ok('change tmpjs')
633-
634-
// this might happen more than once but does not matter in this context
635-
await restartPromise
636-
t.assert.ok('should receive restart event')
637-
t.assert.ok(spy.args.length > 0, 'should print a console message on file update')
638-
})
569+
// Temporarily commented out during migration from TAP to node:test
570+
// test('should start the server with watch options that the child process restart when directory changed', { skip: ['win32', 'darwin'].includes(process.platform) || process.env.CI === 'true' }, async (t) => {
571+
// t.plan(3)
572+
// const tmpjs = path.resolve(baseFilename + '.js')
573+
574+
// const port = getPort()
575+
576+
// await writeFile(tmpjs, 'hello world')
577+
// const argv = ['-p', port, '-w', './examples/plugin.js']
578+
// const fastifyEmitter = await start.start(argv)
579+
580+
// t.after(async () => {
581+
// if (fs.existsSync(tmpjs)) {
582+
// fs.unlinkSync(tmpjs)
583+
// }
584+
// await fastifyEmitter.stop()
585+
// })
586+
587+
// await once(fastifyEmitter, 'ready')
588+
// t.assert.ok('should receive ready event')
589+
590+
// const restartPromise = once(fastifyEmitter, 'restart')
591+
// await writeFile(tmpjs, 'hello fastify', { flag: 'a+' }) // chokidar watch can't catch change event in CI, but local test is all ok. you can remove annotation in local environment.
592+
// t.assert.ok('change tmpjs')
593+
594+
// // this might happen more than once but does not matter in this context
595+
// await restartPromise
596+
// t.assert.ok('should receive restart event')
597+
// })
598+
599+
// test('should start the server with watch and verbose-watch options that the child process restart when directory changed with console message about changes ', { skip: ['win32', 'darwin'].includes(process.platform) || process.env.CI === 'true' }, async (t) => {
600+
// t.plan(4)
601+
602+
// const spy = sinon.spy()
603+
// const watch = proxyquire('../lib/watch', {
604+
// './utils': {
605+
// logWatchVerbose: spy
606+
// }
607+
// })
608+
609+
// const start = proxyquire('../start', {
610+
// './lib/watch': watch
611+
// })
612+
613+
// const tmpjs = path.resolve(baseFilename + '.js')
614+
615+
// const port = getPort()
616+
617+
// await writeFile(tmpjs, 'hello world')
618+
// const argv = ['-p', port, '-w', '--verbose-watch', './examples/plugin.js']
619+
// const fastifyEmitter = await start.start(argv)
620+
621+
// t.after(async () => {
622+
// if (fs.existsSync(tmpjs)) {
623+
// fs.unlinkSync(tmpjs)
624+
// }
625+
// await fastifyEmitter.stop()
626+
// })
627+
628+
// await once(fastifyEmitter, 'ready')
629+
// t.assert.ok('should receive ready event')
630+
631+
// const restartPromise = once(fastifyEmitter, 'restart')
632+
// await writeFile(tmpjs, 'hello fastify', { flag: 'a+' }) // chokidar watch can't catch change event in CI, but local test is all ok. you can remove annotation in local environment.
633+
// t.assert.ok('change tmpjs')
634+
635+
// // this might happen more than once but does not matter in this context
636+
// await restartPromise
637+
// t.assert.ok('should receive restart event')
638+
// t.assert.ok(spy.args.length > 0, 'should print a console message on file update')
639+
// })
639640

640641
test('should reload the env on restart when watching', { skip: process.platform === 'win32' }, async (t) => {
641642
const testdir = await createTestDir({

0 commit comments

Comments
 (0)