Skip to content

Commit 2cb4950

Browse files
committed
Move e2e test dirs into fixtures
1 parent 32a1987 commit 2cb4950

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

e2e/runAllTests.js renamed to e2e/run-all-tests.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console -- node script */
12
import { execSync } from 'node:child_process';
23
import fs from 'node:fs/promises';
34
import path from 'node:path';
@@ -15,7 +16,7 @@ const TEST_COMMAND = 'npm run lint';
1516

1617
const 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

7376
executeAllE2eTests();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": "MIT",
1313
"scripts": {
1414
"build": "tsdown",
15-
"e2e": "node ./e2e/runAllTests.js",
15+
"e2e": "node ./e2e/run-all-tests.js",
1616
"format": "prettier --write .",
1717
"format:check": "prettier --check .",
1818
"lint": "npm-run-all --continue-on-error --aggregate-output --parallel lint:*",

0 commit comments

Comments
 (0)