Skip to content

Commit c339931

Browse files
committed
test: do not open fixture files for writing
Use temp directory for open with `O_DSYNC` (which indicates a write may occur) rather than `fixtures` directory. Additionally, test can be run on macOS so allow that in addition to Linux. PR-URL: nodejs#17810 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 66e6aff commit c339931

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/parallel/test-fs-open-flags.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
// Flags: --expose_internals
2323
'use strict';
2424
const common = require('../common');
25+
2526
const fixtures = require('../common/fixtures');
26-
const assert = require('assert');
2727

28+
const assert = require('assert');
2829
const fs = require('fs');
30+
const path = require('path');
2931

3032
const O_APPEND = fs.constants.O_APPEND || 0;
3133
const O_CREAT = fs.constants.O_CREAT || 0;
@@ -81,8 +83,9 @@ common.expectsError(
8183
{ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
8284
);
8385

84-
if (common.isLinux) {
85-
const file = fixtures.path('a.js');
86-
86+
if (common.isLinux || common.isOSX) {
87+
common.refreshTmpDir();
88+
const file = path.join(common.tmpDir, 'a.js');
89+
fs.copyFileSync(fixtures.path('a.js'), file);
8790
fs.open(file, O_DSYNC, common.mustCall(assert.ifError));
8891
}

0 commit comments

Comments
 (0)