Skip to content

Commit be16cc9

Browse files
Trottaddaleax
authored andcommitted
test: set umask for tests
#25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner. PR-URL: #25229 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3bebcf0 commit be16cc9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/common/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ const {
3434
hasIntl
3535
} = process.binding('config');
3636

37+
// Some tests assume a umask of 0o022 so set that up front. Tests that need a
38+
// different umask will set it themselves.
39+
//
40+
// process.umask() is not available in workers so we need to check for its
41+
// existence.
42+
if (process.umask)
43+
process.umask(0o022);
44+
3745
const noop = () => {};
3846

3947
const hasCrypto = Boolean(process.versions.openssl);

0 commit comments

Comments
 (0)