Skip to content

How can I use test-utils.el for eask test ert 'test/*'? #326

Answered by jcs090218
ROCKTAKEY asked this question in Q&A
Discussion options

You must be logged in to vote

There are many ways to achieve this! :)

Since the Eask-file is an elisp file, you can do:

Option A. Use load or load-file

(load-file "test/test-utils.el")

Option B. Change load-path globally

(add-to-list 'load-path "./test/")

;; then later require it (doesn't have to be in the Eask-file)
(require 'test-utils)

Option C. Use Eask's DSL load-paths

This is essentially the same as Option B..

(load-paths "/test/")

;; then later require it (doesn't have to be in the Eask-file)
(require 'test-utils)

See https://emacs-eask.github.io/DSL/ for more information! :D


A tiny suggestion, you might want to add hook to avoid pollute other command's environment.

(add-hook 'eask-before-test/ert-hook

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ROCKTAKEY
Comment options

Answer selected by ROCKTAKEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants