test: include file mode in assert message
If the REPL history file is created with an invalid mode include the failed mode in the error message. PR-URL: https://github.com/nodejs/node/pull/16815 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
137c780d4b
commit
79f90f3d98
@ -1,4 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// Verifies that the REPL history file is created with mode 0600
|
||||||
|
|
||||||
// Flags: --expose_internals
|
// Flags: --expose_internals
|
||||||
|
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
@ -39,9 +42,10 @@ const checkResults = common.mustCall(function(err, r) {
|
|||||||
|
|
||||||
r.input.end();
|
r.input.end();
|
||||||
const stat = fs.statSync(replHistoryPath);
|
const stat = fs.statSync(replHistoryPath);
|
||||||
|
const fileMode = stat.mode & 0o777;
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
stat.mode & 0o777, 0o600,
|
fileMode, 0o600,
|
||||||
'REPL history file should be mode 0600');
|
`REPL history file should be mode 0600 but was 0${fileMode.toString(8)}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
repl.createInternalRepl(
|
repl.createInternalRepl(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user