Skip to content

Commit 4e03cc7

Browse files
committed
test: fix jest scripts for CI
1 parent 415f024 commit 4e03cc7

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

scripts/jestGlobalSetup.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const os = require('os')
2-
const fs = require('fs')
2+
const fs = require('fs-extra')
33
const path = require('path')
44
const { chromium } = require('playwright-chromium')
55

@@ -14,11 +14,7 @@ module.exports = async () => {
1414

1515
global.__BROWSER_SERVER__ = browserServer
1616

17-
fs.mkdirSync(DIR, { recursive: true })
18-
fs.writeFileSync(path.join(DIR, 'wsEndpoint'), browserServer.wsEndpoint())
19-
20-
const fixtureDir = path.resolve(__dirname, '../temp')
21-
if (fs.existsSync(fixtureDir)) {
22-
fs.rmSync(fixtureDir, { recursive: true })
23-
}
17+
await fs.mkdirp(DIR)
18+
await fs.writeFile(path.join(DIR, 'wsEndpoint'), browserServer.wsEndpoint())
19+
await fs.remove(path.resolve(__dirname, '../temp'))
2420
}

scripts/jestGlobalTeardown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const fs = require('fs')
1+
const fs = require('fs-extra')
22
const path = require('path')
33

44
module.exports = async () => {
55
await global.__BROWSER_SERVER__.close()
66
if (!process.env.VITE_PRESERVE_BUILD_ARTIFACTS) {
7-
fs.rmSync(path.resolve(__dirname, '../temp'), { recursive: true })
7+
await fs.remove(path.resolve(__dirname, '../temp'))
88
}
99
}

0 commit comments

Comments
 (0)