Skip to content

Commit 79b6a54

Browse files
authored
Merge pull request #39 from joshbax189/feat/use-eask
Feat: use eask package manager
2 parents 65a6972 + 61d2dbf commit 79b6a54

File tree

6 files changed

+84
-18
lines changed

6 files changed

+84
-18
lines changed

.github/workflows/actions.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ jobs:
66
matrix:
77
emacs-version: [28, 29]
88
runs-on: ubuntu-latest
9-
container: silex/emacs:${{matrix.emacs-version}}
9+
container: silex/emacs:${{matrix.emacs-version}}-ci-eask
1010
steps:
1111
- name: Check out repository code
1212
uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
1316
- name: Install test dependencies
14-
run: ./install-deps.sh
17+
run: eask install-deps --dev
1518
- name: Run tests
16-
run: ./runtests.sh
19+
run: eask run script test
20+
lint:
21+
runs-on: ubuntu-latest
22+
container: silex/emacs:29-ci-eask
23+
steps:
24+
- name: Check out repository code
25+
uses: actions/checkout@v4
26+
- name: Install test dependencies
27+
run: eask install-deps --dev
28+
- name: Run linters
29+
run: eask lint declare --strict

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.elc
2+
.eask

Eask

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(package "js-comint"
2+
"1.2.0"
3+
"JavaScript interpreter in window.")
4+
5+
(website-url "https://github.com/redguardtoo/js-comint")
6+
(keywords "javascript" "node" "inferior-mode" "convenience")
7+
8+
(package-file "js-comint.el")
9+
10+
(script "test" "eask test ert test-js-comint.el")
11+
12+
(source "gnu")
13+
(source "melpa")
14+
15+
(depends-on "emacs" "28.1")
16+
17+
(development
18+
(depends-on "el-mock")
19+
(depends-on "nvm"))

install-deps.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

runtests.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

test-js-comint.el

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
(require 'js-comint)
44
(require 'ert)
5+
(require 'el-mock)
56

67
(defun js-comint-test-buffer-matches (regex)
78
"Search the js-comint buffer for the given regular expression.
@@ -122,3 +123,49 @@ reduce((prev, curr) => prev + curr, 0);" "^9$")))
122123
(with-environment-variables (("NODE_REPL_MODE" "strict"))
123124
;; global variables are not allowed in strict mode
124125
(js-comint-test-output-matches "foo = 5;" "Uncaught ReferenceError.*")))
126+
127+
(ert-deftest js-comint-select-node-version/test-no-nvm ()
128+
"Should error if nvm is missing."
129+
(let ((original-command-value js-comint-program-command))
130+
(with-mock
131+
(mock (require 'nvm) => (error "Cannot open nvm"))
132+
(should-error (js-comint-select-node-version))
133+
(should-not js-use-nvm)
134+
(should (equal js-comint-program-command
135+
original-command-value)))))
136+
137+
(ert-deftest js-comint-select-node-version/test-with-arg ()
138+
"Should set program-command when called non-interactively."
139+
(let ((original-command-value js-comint-program-command)
140+
(original-use-jvm-value js-use-nvm)
141+
(original-nvm-version js-nvm-current-version))
142+
(unwind-protect
143+
(with-mock
144+
(mock (require 'nvm))
145+
(mock (nvm--find-exact-version-for "foo") => '("foo-1.2" "some_path"))
146+
(js-comint-select-node-version "foo")
147+
(should js-use-nvm)
148+
(should (equal js-comint-program-command
149+
"some_path/bin/node"))
150+
(should (equal js-nvm-current-version
151+
'("foo-1.2" "some_path"))))
152+
(setq js-comint-program-command original-command-value
153+
js-use-nvm original-use-jvm-value
154+
js-nvm-current-version original-nvm-version))))
155+
156+
(ert-deftest js-comint-select-node-version/test-optional-arg ()
157+
"Should set program-command when called with no arg."
158+
(let ((original-command-value js-comint-program-command)
159+
(original-use-jvm-value js-use-nvm)
160+
(original-nvm-version js-nvm-current-version))
161+
(unwind-protect
162+
(with-mock
163+
(mock (require 'nvm))
164+
(mock (js-comint-list-nvm-versions *) => "foo")
165+
(mock (nvm--find-exact-version-for "foo") => '("foo-1.2" "some_path"))
166+
(js-comint-select-node-version)
167+
(should (equal js-comint-program-command
168+
"some_path/bin/node")))
169+
(setq js-comint-program-command original-command-value
170+
js-use-nvm original-use-jvm-value
171+
js-nvm-current-version original-nvm-version))))

0 commit comments

Comments
 (0)