jest-test-mode

Emacs minor mode for running jest (Node.js test framework)

GPL-3.0 License

Stars
24
  • jest-test-mode.el
    [[https://melpa.org/#/jest-test-mode][file:https://melpa.org/packages/jest-test-mode-badge.svg]]

Emacs minor mode for running jest (Nodejs test framework). Inspired by =ruby-test-mode= and =cider-test=.

** Features

  1. Uses =npx jest= to execute tests. This respect your project's version of =jest=.

  2. Keybindings to execute tests for the entire project, a test module, or a top-level test/describe block.

  3. File references in the Test Execution Buffer support jump to definition.

** Keybindings jest-test-mode comes with some default keybindings:

| Binding | Action | |-------------+------------------------------------------------------------------| | C-c C-t n | Runs tests in the current buffer. | | C-c C-t p | Runs all tests in the project. | | C-c C-t t | Runs the it/test/describe block at the current point. | | C-c C-t a | Re-runs the previous test command. | | C-c C-t d n | Runs tests in the current buffer with node debugger. | | C-c C-t d t | Runs the describe block at the current point with node debugger. | | C-c C-t d a | Re-runs the previous test command with node debugger. |

** Installation Install through melpa as =jest-test-mode=.

To configure the project with =use-package=:

#+begin_src elisp (use-package jest-test-mode :ensure t :commands jest-test-mode :hook (typescript-mode js-mode typescript-tsx-mode)) #+end_src

Manually:

#+begin_src elisp (require 'jest-test-mode) (add-hook 'typescript-mode-hook 'jest-test-mode) (add-hook 'js-mode-hook 'jest-test-mode) (add-hook 'typescript-tsx-mode-hook 'jest-test-mode) #+end_src

** Resources Thanks to the following resources for building this layer:

** License This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

** Testing Notes Verify package can be included cleanly:

#+begin_src sh

If using railwaycat/emacs, do this first

export EMACS_COMMAND=/Applications/Emacs.app/Contents/MacOS/Emacs.sh

1 Checkout melpa & cd in

git clone [email protected]:melpa/melpa.git && cd melpa

3 clean things up

git clean -fdx

4 package

make recipes/jest-test-mode

5 test-install

make sandbox INSTALL=jest-test-mode #+end_src