Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor test-fs-options-immutable #13977

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions test/parallel/test-fs-options-immutable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
const common = require('../common');

/*
* These tests make sure that the `options` object passed to these functions are
Expand All @@ -7,10 +8,10 @@
* Refer: https://github.com/nodejs/node/issues/7655
*/

const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
const path = require('path');

const errHandler = (e) => assert.ifError(e);
const options = Object.freeze({});
common.refreshTmpDir();
Expand Down Expand Up @@ -61,13 +62,15 @@ if (common.canCreateSymLink()) {
{
let watch;
assert.doesNotThrow(() => {
watch = fs.watch(__filename, options, common.noop);
watch = fs.watch(__filename, options, common.mustNotCall());
});
watch.close();
}

{
assert.doesNotThrow(() => fs.watchFile(__filename, options, common.noop));
assert.doesNotThrow(
() => fs.watchFile(__filename, options, common.mustNotCall())
);
fs.unwatchFile(__filename);
}

Expand All @@ -89,8 +92,8 @@ if (common.canCreateSymLink()) {
{
const fileName = path.resolve(common.tmpDir, 'streams');
assert.doesNotThrow(() => {
fs.WriteStream(fileName, options).once('open', () => {
fs.WriteStream(fileName, options).once('open', common.mustCall(() => {
assert.doesNotThrow(() => fs.ReadStream(fileName, options));
});
}));
});
}