Skip to content

Commit 387a918

Browse files
committed
Test-fix: prevent CI failure from browserslist
1 parent 6679b7c commit 387a918

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/runner/runners/utils/_tests/_transpiler.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ describe("babelify", () => {
9595
const dangerfile = `import { a } from 'lodash';
9696
a();`
9797

98-
const existsSyncMock = fs.existsSync as jest.Mock
9998
const actualFs = jest.requireActual("fs") as typeof fs
99+
const existsSyncMock = fs.existsSync as jest.Mock
100+
const statSyncMock = fs.statSync as jest.Mock
100101
existsSyncMock.mockImplementation((path) => path === "/a/b/babel.config.js" || actualFs.existsSync(path))
102+
statSyncMock.mockImplementation((path) =>
103+
// browserslist gets called by babelify, and browserslist checks for all imported things to see if they're directories
104+
path === "/a/b/babel.config.js" ? { isDirectory: () => false } : actualFs.statSync(path)
105+
)
101106
jest.mock(
102107
"/a/b/babel.config.js",
103108
() => {

0 commit comments

Comments
 (0)