1
1
import { createNodeFsMountHandler , loadNodeRuntime } from '..' ;
2
- import {
3
- __private__dont__use ,
4
- ErrnoError ,
5
- FSHelpers ,
6
- PHP ,
7
- } from '@php-wasm/universal' ;
2
+ import { __private__dont__use , PHP , FSHelpers } from '@php-wasm/universal' ;
3
+ import { type ErrnoError } from '@php-wasm/universal' ;
8
4
import { RecommendedPHPVersion } from '@wp-playground/common' ;
9
5
import path , { dirname } from 'path' ;
10
6
import fs from 'fs' ;
@@ -83,9 +79,9 @@ describe('Mounting', () => {
83
79
createNodeFsMountHandler ( filePath )
84
80
) ;
85
81
} catch ( e : any ) {
86
- e = e as ErrnoError ;
87
- expect ( e . name ) . toBe ( 'ErrnoError' ) ;
88
- expect ( e . errno ) . toBe ( 10 ) ;
82
+ const error = e as ErrnoError ;
83
+ expect ( error . name ) . toBe ( 'ErrnoError' ) ;
84
+ expect ( error . errno ) . toBe ( 10 ) ;
89
85
}
90
86
} ) ;
91
87
@@ -119,8 +115,8 @@ describe('Mounting', () => {
119
115
try {
120
116
await php . unlink ( fileMountPoint ) ;
121
117
} catch ( e : any ) {
122
- e = e as Error ;
123
- expect ( e . message ) . toContain (
118
+ const error = e as Error ;
119
+ expect ( error . message ) . toContain (
124
120
`Could not unlink "${ fileMountPoint } ": Device or resource busy.`
125
121
) ;
126
122
}
@@ -135,8 +131,8 @@ describe('Mounting', () => {
135
131
try {
136
132
await php . mv ( fileMountPoint , '/single-file-moved.txt' ) ;
137
133
} catch ( e : any ) {
138
- e = e as Error ;
139
- expect ( e . message ) . toContain (
134
+ const error = e as Error ;
135
+ expect ( error . message ) . toContain (
140
136
`Could not move ${ fileMountPoint } to /single-file-moved.txt: Device or resource busy.`
141
137
) ;
142
138
}
@@ -268,9 +264,9 @@ describe('Mounting', () => {
268
264
createNodeFsMountHandler ( directoryPath )
269
265
) ;
270
266
} catch ( e : any ) {
271
- e = e as ErrnoError ;
272
- expect ( e . name ) . toBe ( 'ErrnoError' ) ;
273
- expect ( e . errno ) . toBe ( 10 ) ;
267
+ const error = e as ErrnoError ;
268
+ expect ( error . name ) . toBe ( 'ErrnoError' ) ;
269
+ expect ( error . errno ) . toBe ( 10 ) ;
274
270
}
275
271
} ) ;
276
272
@@ -463,8 +459,8 @@ describe('Mounting', () => {
463
459
try {
464
460
await php . rmdir ( directoryMountPoint ) ;
465
461
} catch ( e : any ) {
466
- e = e as Error ;
467
- expect ( e . message ) . toContain (
462
+ const error = e as Error ;
463
+ expect ( error . message ) . toContain (
468
464
`Could not remove directory "${ directoryMountPoint } ": Device or resource busy.`
469
465
) ;
470
466
}
@@ -479,8 +475,8 @@ describe('Mounting', () => {
479
475
try {
480
476
await php . mv ( directoryMountPoint , '/nested-test-moved' ) ;
481
477
} catch ( e : any ) {
482
- e = e as Error ;
483
- expect ( e . message ) . toContain (
478
+ const error = e as Error ;
479
+ expect ( error . message ) . toContain (
484
480
`Could not move ${ directoryMountPoint } to /nested-test-moved: Device or resource busy.`
485
481
) ;
486
482
}
0 commit comments