Skip to content

Commit 8c2d03f

Browse files
committed
test: make minimal-config test pass locally on node 22
See comments I also made it fail immediately when an assertion fails. As is, we weren't calling the done callback in these cases, so you had to wait 30s for the test to time out.
1 parent 4a30e49 commit 8c2d03f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/gatsby/cache-dir/__tests__/minimal-config.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,18 @@ it(`Builds cache-dir with minimal config`, done => {
2525
})
2626

2727
spawn.on(`close`, function () {
28-
expect(stderr).toEqual(``)
29-
expect(stdout).not.toEqual(``)
28+
try {
29+
// This is a little weird but this node.js deprecation warning is printed on node 22+ BUT we
30+
// fully suppress all node.js warnings in CI for some reason. This pattern allows either
31+
// nothing or just this warning to be printed to stderr, allowing it to pass locally and in CI.
32+
expect(stderr).toMatch(
33+
/^(|\(node:\d+\) \[DEP0180\] DeprecationWarning: fs\.Stats constructor is deprecated\.\s+\(Use `node --trace-deprecation \.\.\.` to show where the warning was created\)[\s\n]*)$/s
34+
)
35+
expect(stdout).not.toEqual(``)
36+
} catch (err) {
37+
done(err)
38+
return
39+
}
3040
done()
3141
})
3242
}, 30000)

0 commit comments

Comments
 (0)