summaryrefslogtreecommitdiff
path: root/test/parallel/test-repl-persistent-history.js
diff options
context:
space:
mode:
authorChris Budy <chris@budy.org>2017-10-06 10:05:16 -0700
committerRuben Bridgewater <ruben@bridgewater.de>2017-10-08 15:12:08 -0700
commitab3c84fc25320893e65fb0f5070b5ea4896350c7 (patch)
tree4b5bb2a3390f522cee144479091dc086501c5ff1 /test/parallel/test-repl-persistent-history.js
parent37681b5e09a755e2cd9631429dcd1d2b5f0650f2 (diff)
downloadandroid-node-v8-ab3c84fc25320893e65fb0f5070b5ea4896350c7.tar.gz
android-node-v8-ab3c84fc25320893e65fb0f5070b5ea4896350c7.tar.bz2
android-node-v8-ab3c84fc25320893e65fb0f5070b5ea4896350c7.zip
test: use defaultHistoryPath instead of path.join
PR-URL: https://github.com/nodejs/node/pull/15969 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-repl-persistent-history.js')
-rw-r--r--test/parallel/test-repl-persistent-history.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/test/parallel/test-repl-persistent-history.js b/test/parallel/test-repl-persistent-history.js
index 8b47cadf11..c4bfdac606 100644
--- a/test/parallel/test-repl-persistent-history.js
+++ b/test/parallel/test-repl-persistent-history.js
@@ -51,6 +51,24 @@ ActionStream.prototype.readable = true;
const UP = { name: 'up' };
const ENTER = { name: 'enter' };
const CLEAR = { ctrl: true, name: 'u' };
+
+// File paths
+const fixtures = common.fixturesDir;
+const historyFixturePath = path.join(fixtures, '.node_repl_history');
+const historyPath = path.join(common.tmpDir, '.fixture_copy_repl_history');
+const historyPathFail = path.join(common.tmpDir, '.node_repl\u0000_history');
+const oldHistoryPathObj = path.join(fixtures,
+ 'old-repl-history-file-obj.json');
+const oldHistoryPathFaulty = path.join(fixtures,
+ 'old-repl-history-file-faulty.json');
+const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
+const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
+const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
+const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
+const emptyHiddenHistoryPath = path.join(fixtures,
+ '.empty-hidden-repl-history-file');
+const devNullHistoryPath = path.join(common.tmpDir,
+ '.dev-null-repl-history-file');
// Common message bits
const prompt = '> ';
const replDisabled = '\nPersistent history support disabled. Set the ' +
@@ -58,7 +76,7 @@ const replDisabled = '\nPersistent history support disabled. Set the ' +
'user-writable path to enable.\n';
const convertMsg = '\nConverted old JSON repl history to line-separated ' +
'history.\nThe new repl history file can be found at ' +
- `${path.join(common.tmpDir, '.node_repl_history')}.\n`;
+ `${defaultHistoryPath}.\n`;
const homedirErr = '\nError: Could not get the home directory.\n' +
'REPL session history will not be persisted.\n';
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' +
'.\nREPL session history will not be persisted.\n';
const sameHistoryFilePaths = '\nThe old repl history file has the same name ' +
'and location as the new one i.e., ' +
- path.join(common.tmpDir, '.node_repl_history') +
+ `${defaultHistoryPath}` +
' and is empty.\nUsing it as is.\n';
-// File paths
-const fixtures = common.fixturesDir;
-const historyFixturePath = path.join(fixtures, '.node_repl_history');
-const historyPath = path.join(common.tmpDir, '.fixture_copy_repl_history');
-const historyPathFail = path.join(common.tmpDir, '.node_repl\u0000_history');
-const oldHistoryPathObj = path.join(fixtures,
- 'old-repl-history-file-obj.json');
-const oldHistoryPathFaulty = path.join(fixtures,
- 'old-repl-history-file-faulty.json');
-const oldHistoryPath = path.join(fixtures, 'old-repl-history-file.json');
-const enoentHistoryPath = path.join(fixtures, 'enoent-repl-history-file.json');
-const emptyHistoryPath = path.join(fixtures, '.empty-repl-history-file');
-const defaultHistoryPath = path.join(common.tmpDir, '.node_repl_history');
-const emptyHiddenHistoryPath = path.join(fixtures,
- '.empty-hidden-repl-history-file');
-const devNullHistoryPath = path.join(common.tmpDir,
- '.dev-null-repl-history-file');
const tests = [
{