@@ -12,7 +12,8 @@ import { test } from '@japa/runner'
12
12
import { cliui } from '@poppinss/cliui'
13
13
import { setTimeout as sleep } from 'node:timers/promises'
14
14
import { DevServer } from '../index.ts'
15
- import { join } from 'node:path'
15
+ import { join , sep } from 'node:path'
16
+ import { platform } from 'node:os'
16
17
17
18
test . group ( 'DevServer' , ( ) => {
18
19
test ( 'start() and execute dev server hook' , async ( { fs, assert, cleanup } ) => {
@@ -214,11 +215,16 @@ test.group('DevServer', () => {
214
215
} ) . timeout ( 8 * 1000 )
215
216
216
217
test ( 'restart server if hot-hook:full-reload message is received' , async ( { assert, fs } ) => {
217
- const filePath = join ( fs . basePath , 'start/routes.ts' )
218
+ let filePath = join ( fs . basePath , 'start/routes.ts' )
219
+ if ( platform ( ) === 'win32' ) {
220
+ filePath = filePath . split ( sep ) . join ( '\\\\' )
221
+ console . log ( { filePath } )
222
+ }
223
+
218
224
await fs . createJson ( 'tsconfig.json' , { include : [ '**/*' ] , exclude : [ ] } )
219
225
await fs . create (
220
226
'bin/server.ts' ,
221
- `process.send({ type: 'hot-hook:full-reload', path: "${ filePath . replace ( / \/ / g , '\\/' ) } " });`
227
+ `process.send({ type: 'hot-hook:full-reload', path: "${ filePath } " });`
222
228
)
223
229
await fs . dump ( 'bin/server.ts' )
224
230
await fs . create ( 'start/routes.ts' , `` )
0 commit comments