1
+ /* eslint-disable no-console -- node script */
1
2
import { execSync } from 'node:child_process' ;
2
3
import fs from 'node:fs/promises' ;
3
4
import path from 'node:path' ;
@@ -15,7 +16,7 @@ const TEST_COMMAND = 'npm run lint';
15
16
16
17
const getRoot = ( ) => {
17
18
return execSync ( 'git rev-parse --show-toplevel' , {
18
- encoding : 'utf-8 ' ,
19
+ encoding : 'utf8 ' ,
19
20
} ) . trim ( ) ;
20
21
} ;
21
22
@@ -32,11 +33,12 @@ const executeAllE2eTests = async () => {
32
33
} ) ;
33
34
34
35
// Get all directories in the e2e dir
35
- const testDirs = ( await fs . readdir ( fixturesDir , { withFileTypes : true } ) )
36
+ const allFixtureFiles = await fs . readdir ( fixturesDir , { withFileTypes : true } ) ;
37
+ const testDirs = allFixtureFiles
36
38
. filter ( ( dirEnt ) => dirEnt . isDirectory ( ) )
37
39
. map ( ( dirEnt ) => path . join ( dirEnt . parentPath , dirEnt . name ) ) ;
38
40
39
- if ( testDirs . length ) {
41
+ if ( testDirs . length > 0 ) {
40
42
console . log ( `Running ${ testDirs . length } end to end tests.` )
41
43
console . log ( `\n${ '-' . repeat ( 50 ) } \n` ) ;
42
44
} else {
@@ -53,14 +55,14 @@ const executeAllE2eTests = async () => {
53
55
stdio : 'inherit' ,
54
56
} ) ;
55
57
console . log ( `✅ Test passed` ) ;
56
- } catch ( error ) {
58
+ } catch {
57
59
console . log ( `❌ Test failed` ) ;
58
60
failedTests . push ( dirName ) ;
59
61
}
60
62
console . log ( `\n${ '-' . repeat ( 50 ) } \n` ) ;
61
63
}
62
64
63
- if ( failedTests . length ) {
65
+ if ( failedTests . length > 0 ) {
64
66
console . log (
65
67
`Testing complete. ${ failedTests . length } of ${ testDirs . length } tests failed!` ,
66
68
) ;
@@ -69,5 +71,6 @@ const executeAllE2eTests = async () => {
69
71
console . log ( `Testing complete. All ${ testDirs . length } tests passed!` ) ;
70
72
}
71
73
} ;
74
+ /* eslint-enable no-console -- node script */
72
75
73
76
executeAllE2eTests ( ) ;
0 commit comments