Skip to content

Commit 5d5a6ca

Browse files
Avoiding using beforeAll/afterAll hooks, as they would mess up with future parallelization
1 parent 67c31b2 commit 5d5a6ca

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

test/__tests__/ignore-path.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
import fs from "node:fs/promises";
1+
import fs from "node:fs";
22
import { getFixturesPath, runCli } from "../utils";
33

4-
// `.js` files are ignored in `.gitignore`
5-
const files = [
4+
// These `.js` files are ignored in `.gitignore`, so we need to write them manually here
5+
[
66
"ignore-path/ignore-path-test/ignored-by-customignore.js",
77
"ignore-path/ignore-path-test/ignored-by-gitignore.js",
88
"ignore-path/ignore-path-test/ignored-by-prettierignore.js",
9-
].map(getFixturesPath);
10-
11-
const clean = () =>
12-
Promise.all(files.map((file) => fs.rm(file, { force: true })));
13-
const setup = () =>
14-
Promise.all(files.map((file) => fs.writeFile(file, " a+ b")));
15-
16-
beforeAll(setup);
17-
afterAll(clean);
9+
].forEach(file => {
10+
fs.writeFileSync(getFixturesPath(file), " a+ b");
11+
});
1812

1913
const getUnformattedFiles = async (args) => {
2014
const { stdout } = await runCli("ignore-path/ignore-path-test/", [

0 commit comments

Comments
 (0)