Browse Source

Fix #207

* indium-nodejs.el (indium-nodejs--command-with-flags): Match `babel-node` as
  well as `node`.
* test/unit/indium-nodejs-test.el: Add a unit test for babel-node.
drone 2.1.2
Nicolas Petton 2 years ago
parent
commit
a55f3c2eaa
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
2 changed files with 13 additions and 4 deletions
  1. +8
    -3
      indium-nodejs.el
  2. +5
    -1
      test/unit/indium-nodejs-test.el

+ 8
- 3
indium-nodejs.el View File

@ -74,9 +74,14 @@ If PORT is non-nil, start the debugging process on that port,
otherwise use Node's default port (9229)."
(let ((inspect-flag (if (eq inspect-brk t) " --inspect-brk" " --inspect"))
(inspect-port-flag (if port (format " --inspect-port=%s" port) "")))
(if (string-match "\\<node\\>" command)
(replace-match (format "node%s%s" inspect-flag inspect-port-flag) nil nil command)
(user-error "Invalid command specified"))))
(save-match-data
(if (string-match "\\<\\(babel-\\)?node\\>" command)
(replace-match (format "%s%s%s"
(match-string 0 command)
inspect-flag
inspect-port-flag)
nil nil command)
(user-error "Invalid command specified")))))
(defun indium-nodejs--process-filter-function (conf)
"Return a process filter function for CONF.


+ 5
- 1
test/unit/indium-nodejs-test.el View File

@ -55,7 +55,11 @@
(expect (indium-nodejs--command-with-flags "node foo" nil 2000)
:to-equal "node --inspect --inspect-port=2000 foo")
(expect (indium-nodejs--command-with-flags "node foo" t 2000)
:to-equal "node --inspect-brk --inspect-port=2000 foo")))
:to-equal "node --inspect-brk --inspect-port=2000 foo"))
(it "should be able to launch with `babel-node'"
(expect (indium-nodejs--command-with-flags "babel-node foo" nil 2000)
:to-equal "babel-node --inspect --inspect-port=2000 foo")))
(provide 'indium-nodejs-test)
;;; indium-nodejs-test.el ends here

Loading…
Cancel
Save