Skip to content

Commit 65a6972

Browse files
authored
Merge pull request #38 from joshbax189/fix/update-node-args
Update args for repl.start()
2 parents 103e574 + b99d805 commit 65a6972

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

js-comint.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@
137137
(defvar js-comint-code-format
138138
(concat
139139
"process.stdout.columns = %d;"
140-
"require('repl').start('%s', null, null, true, false, "
141-
"require('repl')['REPL_MODE_' + '%s'.toUpperCase()])"))
140+
"require('repl').start({
141+
\"prompt\": '%s',
142+
\"ignoreUndefined\": true,
143+
\"preview\": true
144+
})"))
142145

143146
(defvar js-nvm-current-version nil
144147
"Current version of node for js-comint.
@@ -308,9 +311,8 @@ Create a new Javascript REPL process."
308311
js-comint-module-paths)))
309312
(all-paths-list (seq-remove 'string-empty-p all-paths-list))
310313
(local-node-path (string-join all-paths-list (js-comint--path-sep)))
311-
(repl-mode (or (getenv "NODE_REPL_MODE") "magic"))
312314
(js-comint-code (format js-comint-code-format
313-
(window-width) js-comint-prompt repl-mode)))
315+
(window-width) js-comint-prompt)))
314316
(with-environment-variables (("NODE_NO_READLINE" "1")
315317
("NODE_PATH" local-node-path))
316318
(pop-to-buffer

test-js-comint.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,9 @@ reduce((prev, curr) => prev + curr, 0);" "^9$")))
116116
(setenv "NODE_PATH" original-env)
117117
(fset 'js-comint--suggest-module-path original-suggest)
118118
(js-comint-test-exit-comint))))
119+
120+
(ert-deftest js-comint/test-strict-mode ()
121+
"When NODE_REPL_MODE=strict should use strict mode."
122+
(with-environment-variables (("NODE_REPL_MODE" "strict"))
123+
;; global variables are not allowed in strict mode
124+
(js-comint-test-output-matches "foo = 5;" "Uncaught ReferenceError.*")))

0 commit comments

Comments
 (0)