mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: update test-fs-fsync to run from temp
We copy the "a.js" file fixture to a temp directory and then we open it with write access. This makes sure we are only writing to the provided temp-dir and not in the fixture dir. PR-URL: https://github.com/nodejs/node/pull/15537 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
1 parent
6faede7eb4
commit
d9cc105102
1 file changed
+8
-2
@@ -25,10 +25,16 @@ const assert = require('assert');
|
||||
const fixtures = require('../common/fixtures');
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const file = fixtures.path('a.js');
|
||||
const fileFixture = fixtures.path('a.js');
|
||||
const fileTemp = path.join(common.tmpDir, 'a.js');
|
||||
|
||||
fs.open(file, 'a', 0o777, common.mustCall(function(err, fd) {
|
||||
// Copy fixtures to temp.
|
||||
common.refreshTmpDir();
|
||||
fs.copyFileSync(fileFixture, fileTemp);
|
||||
|
||||
fs.open(fileFixture, 'a', 0o777, common.mustCall(function(err, fd) {
|
||||
assert.ifError(err);
|
||||
|
||||
fs.fdatasyncSync(fd);
|
||||
|
||||
Reference in new issue
Block a user