Skip to content

Commit

Permalink
Refactor run-tests.bash using Eask.
Browse files Browse the repository at this point in the history
  • Loading branch information
llemaitre19 committed Mar 21, 2024
1 parent 4e351fb commit 825802d
Showing 1 changed file with 9 additions and 30 deletions.
39 changes: 9 additions & 30 deletions tests/run-tests.bash
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
#! /bin/bash

# Run tests locally (as close as possible to Github Worflows).
# It requires Nix (https://nixos.org/download)
# It requires:
# - Eask CLI (https://emacs-eask.github.io/)
# - Nix (https://nixos.org/download)
# - Enabling Nix 'nix-command' and 'flakes' experimental features (https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-experimental-features)

init_dir="/tmp/.emacs.d_jtsx_tests"
emacs_versions=("emacs-29-1" "emacs-29-2" "emacs-snapshot")

# Ensure that Emacs init dir is empty
rm -rf $init_dir

# Run tests on each Emacs versions
for version in ${emacs_versions[@]}; do
emacs_nix="nix run --accept-flake-config github:purcell/nix-emacs-ci#$version --"
printf "RUN PACKAGE-LINT ON '%s'.\n" $version
if ! $emacs_nix --batch \
--eval "(progn \
(require 'package) \
(push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \
(package-initialize) \
(unless package-archive-contents \
(package-refresh-contents)) \
(unless (package-installed-p 'package-lint) \
(package-install 'package-lint)))" \
--eval "(require 'package-lint)" \
-f package-lint-batch-and-exit ../jtsx.el; then
printf "PACKAGE LINT FAILURE ON '%s'.\n" $version
printf "###### RUN TESTS ON '%s'. ######\n" $version
emacs_nix="github:purcell/nix-emacs-ci#$version"
if ! nix shell $emacs_nix nixpkgs#eask --command make -C ../ ci; then
printf "###### TESTS FAILURE ON '%s'. ######\n" $version
exit
fi
printf "RUN TESTS ON '%s'.\n" $version
if ! $emacs_nix --init-directory=$init_dir --batch -l ert -l ../jtsx.el -l jtsx-tests.el \
--eval "(jtsx-install-treesit-language 'javascript)" \
--eval "(jtsx-install-treesit-language 'tsx)" \
--eval "(jtsx-install-treesit-language 'typescript)" \
-f ert-run-tests-batch-and-exit; then
printf "TESTS FAILURE ON '%s'.\n" $version
exit
fi
done

echo "TESTS SUCCESS!"
echo "###### TESTS SUCCESS! ######"

0 comments on commit 825802d

Please sign in to comment.