@@ -58,11 +58,6 @@ const CLEAR = { ctrl: true, name: 'u' };
5858const historyFixturePath = fixtures . path ( '.node_repl_history' ) ;
5959const historyPath = path . join ( tmpdir . path , '.fixture_copy_repl_history' ) ;
6060const historyPathFail = fixtures . path ( 'nonexistent_folder' , 'filename' ) ;
61- const oldHistoryPathObj = fixtures . path ( 'old-repl-history-file-obj.json' ) ;
62- const oldHistoryPathFaulty = fixtures . path ( 'old-repl-history-file-faulty.json' ) ;
63- const oldHistoryPath = fixtures . path ( 'old-repl-history-file.json' ) ;
64- const enoentHistoryPath = fixtures . path ( 'enoent-repl-history-file.json' ) ;
65- const emptyHistoryPath = fixtures . path ( '.empty-repl-history-file' ) ;
6661const defaultHistoryPath = path . join ( tmpdir . path , '.node_repl_history' ) ;
6762const emptyHiddenHistoryPath = fixtures . path ( '.empty-hidden-repl-history-file' ) ;
6863const devNullHistoryPath = path . join ( tmpdir . path ,
@@ -72,23 +67,10 @@ const prompt = '> ';
7267const replDisabled = '\nPersistent history support disabled. Set the ' +
7368 'NODE_REPL_HISTORY environment\nvariable to a valid, ' +
7469 'user-writable path to enable.\n' ;
75- const convertMsg = '\nConverted old JSON repl history to line-separated ' +
76- 'history.\nThe new repl history file can be found at ' +
77- `${ defaultHistoryPath } .\n` ;
7870const homedirErr = '\nError: Could not get the home directory.\n' +
7971 'REPL session history will not be persisted.\n' ;
8072const replFailedRead = '\nError: Could not open history file.\n' +
8173 'REPL session history will not be persisted.\n' ;
82- const oldHistoryFailedOpen = '\nError: Could not open old history file.\n' +
83- 'REPL session history will not be persisted.\n' ;
84- const oldHistoryFailedParse = '\nError: Could not parse old history file.\n' +
85- 'REPL session history will not be persisted.\n' ;
86- const oldHistoryObj = '\nError: The old history file data has to be an Array' +
87- '.\nREPL session history will not be persisted.\n' ;
88- const sameHistoryFilePaths = '\nThe old repl history file has the same name ' +
89- 'and location as the new one i.e., ' +
90- `${ defaultHistoryPath } ` +
91- ' and is empty.\nUsing it as is.\n' ;
9274
9375const tests = [
9476 {
@@ -101,84 +83,28 @@ const tests = [
10183 test : [ UP ] ,
10284 expected : [ prompt , replDisabled , prompt ]
10385 } ,
104- {
105- env : { NODE_REPL_HISTORY_FILE : enoentHistoryPath } ,
106- test : [ UP ] ,
107- expected : [ prompt , oldHistoryFailedOpen , prompt ]
108- } ,
109- {
110- env : { NODE_REPL_HISTORY_FILE : oldHistoryPathObj } ,
111- test : [ UP ] ,
112- expected : [ prompt , oldHistoryObj , prompt ]
113- } ,
114- {
115- env : { NODE_REPL_HISTORY_FILE : oldHistoryPathFaulty } ,
116- test : [ UP ] ,
117- expected : [ prompt , oldHistoryFailedParse , prompt ]
118- } ,
119- {
120- env : { NODE_REPL_HISTORY : '' ,
121- NODE_REPL_HISTORY_FILE : oldHistoryPath } ,
122- test : [ UP ] ,
123- expected : [ prompt , replDisabled , prompt ]
124- } ,
125- {
126- env : { NODE_REPL_HISTORY_FILE : emptyHistoryPath } ,
127- test : [ UP ] ,
128- expected : [ prompt , convertMsg , prompt ]
129- } ,
130- {
131- env : { NODE_REPL_HISTORY_FILE : defaultHistoryPath } ,
132- test : [ UP ] ,
133- expected : [ prompt , sameHistoryFilePaths , prompt ]
134- } ,
13586 {
13687 env : { NODE_REPL_HISTORY : historyPath } ,
13788 test : [ UP , CLEAR ] ,
13889 expected : [ prompt , `${ prompt } 'you look fabulous today'` , prompt ]
13990 } ,
140- {
141- env : { NODE_REPL_HISTORY : historyPath ,
142- NODE_REPL_HISTORY_FILE : oldHistoryPath } ,
143- test : [ UP , CLEAR ] ,
144- expected : [ prompt , `${ prompt } 'you look fabulous today'` , prompt ]
145- } ,
146- {
147- env : { NODE_REPL_HISTORY : historyPath ,
148- NODE_REPL_HISTORY_FILE : '' } ,
149- test : [ UP , CLEAR ] ,
150- expected : [ prompt , `${ prompt } 'you look fabulous today'` , prompt ]
151- } ,
15291 {
15392 env : { } ,
154- test : [ UP ] ,
155- expected : [ prompt ]
156- } ,
157- {
158- env : { NODE_REPL_HISTORY_FILE : oldHistoryPath } ,
159- test : [ UP , CLEAR , '\'42\'' , ENTER ] ,
160- expected : [ prompt , convertMsg , prompt , `${ prompt } '=^.^='` , prompt , '\'' ,
161- '4' , '2' , '\'' , '\'42\'\n' , prompt , prompt ] ,
93+ test : [ UP , '\'42\'' , ENTER ] ,
94+ expected : [ prompt , '\'' , '4' , '2' , '\'' , '\'42\'\n' , prompt , prompt ] ,
16295 clean : false
16396 } ,
164- { // Requires the above testcase
97+ { // Requires the above test case
16598 env : { } ,
16699 test : [ UP , UP , ENTER ] ,
167- expected : [ prompt , `${ prompt } '42'` , `${ prompt } '=^.^='` , '\'=^.^=\'\n' ,
168- prompt ]
100+ expected : [ prompt , `${ prompt } '42'` , '\'42\'\n' , prompt ]
169101 } ,
170102 {
171103 env : { NODE_REPL_HISTORY : historyPath ,
172104 NODE_REPL_HISTORY_SIZE : 1 } ,
173105 test : [ UP , UP , CLEAR ] ,
174106 expected : [ prompt , `${ prompt } 'you look fabulous today'` , prompt ]
175107 } ,
176- {
177- env : { NODE_REPL_HISTORY_FILE : oldHistoryPath ,
178- NODE_REPL_HISTORY_SIZE : 1 } ,
179- test : [ UP , UP , UP , CLEAR ] ,
180- expected : [ prompt , convertMsg , prompt , `${ prompt } '=^.^='` , prompt ]
181- } ,
182108 {
183109 env : { NODE_REPL_HISTORY : historyPathFail ,
184110 NODE_REPL_HISTORY_SIZE : 1 } ,
0 commit comments