@@ -6,6 +6,7 @@ import rl from "node:readline";
66import stream from "node:stream" ;
77import { setTimeout } from "node:timers/promises" ;
88import { stripVTControlCharacters } from "node:util" ;
9+ import { removeDir } from "@fixture/shared/src/fs-helpers" ;
910import { fetch } from "undici" ;
1011/* eslint-disable workers-sdk/no-vitest-import-expect -- complex test with .each patterns */
1112import {
@@ -380,22 +381,8 @@ if (process.platform === "win32") {
380381 } ) ;
381382 }
382383 } ) ;
383- afterAll ( async ( ) => {
384- try {
385- fs . rmSync ( tmpDir , { recursive : true , force : true } ) ;
386- } catch ( e ) {
387- // It seems that Windows doesn't let us delete this, with errors like:
388- //
389- // Error: EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ'
390- // ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
391- // Serialized Error: {
392- // "code": "EBUSY",
393- // "errno": -4082,
394- // "path": "C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ",
395- // "syscall": "rmdir",
396- // }
397- console . error ( e ) ;
398- }
384+ afterAll ( ( ) => {
385+ removeDir ( tmpDir , { fireAndForget : true } ) ;
399386 } ) ;
400387
401388 it ( "should print rebuild containers hotkey" , async ( ) => {
@@ -560,22 +547,8 @@ if (process.platform === "win32") {
560547 }
561548 } ) ;
562549
563- afterAll ( async ( ) => {
564- try {
565- fs . rmSync ( tmpDir , { recursive : true , force : true } ) ;
566- } catch ( e ) {
567- // It seems that Windows doesn't let us delete this, with errors like:
568- //
569- // Error: EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ'
570- // ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
571- // Serialized Error: {
572- // "code": "EBUSY",
573- // "errno": -4082,
574- // "path": "C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ",
575- // "syscall": "rmdir",
576- // }
577- console . error ( e ) ;
578- }
550+ afterAll ( ( ) => {
551+ removeDir ( tmpDir , { fireAndForget : true } ) ;
579552 } ) ;
580553
581554 it ( "should allow quitting while the image is building" , async ( ) => {
@@ -675,22 +648,8 @@ if (process.platform === "win32") {
675648 } ) ;
676649 }
677650 } ) ;
678- afterAll ( async ( ) => {
679- try {
680- fs . rmSync ( tmpDir , { recursive : true , force : true } ) ;
681- } catch ( e ) {
682- // It seems that Windows doesn't let us delete this, with errors like:
683- //
684- // Error: EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ'
685- // ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
686- // Serialized Error: {
687- // "code": "EBUSY",
688- // "errno": -4082,
689- // "path": "C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ",
690- // "syscall": "rmdir",
691- // }
692- console . error ( e ) ;
693- }
651+ afterAll ( ( ) => {
652+ removeDir ( tmpDir , { fireAndForget : true } ) ;
694653 } ) ;
695654
696655 it ( "should print build logs for all the containers" , async ( ) => {
@@ -837,22 +796,8 @@ if (process.platform === "win32") {
837796 } ) ;
838797 }
839798 } ) ;
840- afterAll ( async ( ) => {
841- try {
842- fs . rmSync ( tmpDir , { recursive : true , force : true } ) ;
843- } catch ( e ) {
844- // It seems that Windows doesn't let us delete this, with errors like:
845- //
846- // Error: EBUSY: resource busy or locked, rmdir 'C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ'
847- // ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
848- // Serialized Error: {
849- // "code": "EBUSY",
850- // "errno": -4082,
851- // "path": "C:\Users\RUNNER~1\AppData\Local\Temp\wrangler-modules-pKJ7OQ",
852- // "syscall": "rmdir",
853- // }
854- console . error ( e ) ;
855- }
799+ afterAll ( ( ) => {
800+ removeDir ( tmpDir , { fireAndForget : true } ) ;
856801 } ) ;
857802
858803 it ( "should be able to interact with both workers, rebuild the containers with the hotkey and all containers should be cleaned up at the end" , async ( ) => {
0 commit comments