Skip to content

Commit b564fe2

Browse files
chrisbudyMylesBorins
authored andcommitted
test: use defaultHistoryPath instead of path.join
PR-URL: #15969 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent ece6cd1 commit b564fe2

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

test/parallel/test-repl-persistent-history.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,32 @@ ActionStream.prototype.readable = true;
5151
const UP = { name: 'up' };
5252
const ENTER = { name: 'enter' };
5353
const CLEAR = { ctrl: true, name: 'u' };
54+
55+
// File paths
56+
const fixtures = common.fixturesDir;
57+
const historyFixturePath = path.join(fixtures, '.node_repl_history');
58+
const historyPath = path.join(common.tmpDir, '.fixture_copy_repl_history');
59+
const historyPathFail = path.join(common.tmpDir, '.node_repl\u0000_history');
60+
const oldHistoryPathObj = path.join(fixtures,
61+
'old-repl-history-file-obj.json');
62+
const oldHistoryPathFaulty = path.join(fixtures,
63+
'old-repl-history-file-faulty.json');
64+
const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
65+
const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
66+
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
67+
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
68+
const emptyHiddenHistoryPath = path.join(fixtures,
69+
'.empty-hidden-repl-history-file');
70+
const devNullHistoryPath = path.join(common.tmpDir,
71+
'.dev-null-repl-history-file');
5472
// Common message bits
5573
const prompt = '> ';
5674
const replDisabled = '\nPersistent history support disabled. Set the ' +
5775
'NODE_REPL_HISTORY environment\nvariable to a valid, ' +
5876
'user-writable path to enable.\n';
5977
const convertMsg = '\nConverted old JSON repl history to line-separated ' +
6078
'history.\nThe new repl history file can be found at ' +
61-
`${path.join(common.tmpDir, '.node_repl_history')}.\n`;
79+
`${defaultHistoryPath}.\n`;
6280
const homedirErr = '\nError: Could not get the home directory.\n' +
6381
'REPL session history will not be persisted.\n';
6482
const replFailedRead = '\nError: Could not open history file.\n' +
@@ -71,25 +89,8 @@ const oldHistoryObj = '\nError: The old history file data has to be an Array' +
7189
'.\nREPL session history will not be persisted.\n';
7290
const sameHistoryFilePaths = '\nThe old repl history file has the same name ' +
7391
'and location as the new one i.e., ' +
74-
path.join(common.tmpDir, '.node_repl_history') +
92+
`${defaultHistoryPath}` +
7593
' and is empty.\nUsing it as is.\n';
76-
// File paths
77-
const fixtures = common.fixturesDir;
78-
const historyFixturePath = path.join(fixtures, '.node_repl_history');
79-
const historyPath = path.join(common.tmpDir, '.fixture_copy_repl_history');
80-
const historyPathFail = path.join(common.tmpDir, '.node_repl\u0000_history');
81-
const oldHistoryPathObj = path.join(fixtures,
82-
'old-repl-history-file-obj.json');
83-
const oldHistoryPathFaulty = path.join(fixtures,
84-
'old-repl-history-file-faulty.json');
85-
const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
86-
const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
87-
const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
88-
const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
89-
const emptyHiddenHistoryPath = path.join(fixtures,
90-
'.empty-hidden-repl-history-file');
91-
const devNullHistoryPath = path.join(common.tmpDir,
92-
'.dev-null-repl-history-file');
9394

9495
const tests = [
9596
{

0 commit comments

Comments
 (0)