1+ /* eslint-disable no-console -- node script */
12import { execSync } from 'node:child_process' ;
23import fs from 'node:fs/promises' ;
34import path from 'node:path' ;
@@ -15,7 +16,7 @@ const TEST_COMMAND = 'npm run lint';
1516
1617const getRoot = ( ) => {
1718 return execSync ( 'git rev-parse --show-toplevel' , {
18- encoding : 'utf-8 ' ,
19+ encoding : 'utf8 ' ,
1920 } ) . trim ( ) ;
2021} ;
2122
@@ -32,11 +33,12 @@ const executeAllE2eTests = async () => {
3233 } ) ;
3334
3435 // 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
3638 . filter ( ( dirEnt ) => dirEnt . isDirectory ( ) )
3739 . map ( ( dirEnt ) => path . join ( dirEnt . parentPath , dirEnt . name ) ) ;
3840
39- if ( testDirs . length ) {
41+ if ( testDirs . length > 0 ) {
4042 console . log ( `Running ${ testDirs . length } end to end tests.` )
4143 console . log ( `\n${ '-' . repeat ( 50 ) } \n` ) ;
4244 } else {
@@ -53,14 +55,14 @@ const executeAllE2eTests = async () => {
5355 stdio : 'inherit' ,
5456 } ) ;
5557 console . log ( `✅ Test passed` ) ;
56- } catch ( error ) {
58+ } catch {
5759 console . log ( `❌ Test failed` ) ;
5860 failedTests . push ( dirName ) ;
5961 }
6062 console . log ( `\n${ '-' . repeat ( 50 ) } \n` ) ;
6163 }
6264
63- if ( failedTests . length ) {
65+ if ( failedTests . length > 0 ) {
6466 console . log (
6567 `Testing complete. ${ failedTests . length } of ${ testDirs . length } tests failed!` ,
6668 ) ;
@@ -69,5 +71,6 @@ const executeAllE2eTests = async () => {
6971 console . log ( `Testing complete. All ${ testDirs . length } tests passed!` ) ;
7072 }
7173} ;
74+ /* eslint-enable no-console -- node script */
7275
7376executeAllE2eTests ( ) ;
0 commit comments