-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(test): Add built-in ecukes test command (#236)
* feat(test): Add built-in ecukes test command * Make ecukes accept files * changelog * Add ecukes test * Add badge * fix name and copyright
- Loading branch information
Showing
15 changed files
with
208 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Test ecukes | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'eask' | ||
- '**.yml' | ||
- lisp/** | ||
- cmds/** | ||
- src/** | ||
- test/** | ||
pull_request: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- '**.md' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
emacs-version: | ||
- 29.2 | ||
|
||
steps: | ||
- uses: jcs090218/setup-emacs@master | ||
with: | ||
version: ${{ matrix.emacs-version }} | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Prepare Eask (Unix) | ||
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' | ||
run: | | ||
chmod -R 777 ./ | ||
.github/scripts/setup-eask | ||
- name: Prepare Eask (Windows) | ||
if: matrix.os == 'windows-latest' | ||
run: .github/scripts/setup-eask.ps1 | ||
|
||
- name: Testing... | ||
run: | | ||
make test-ecukes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (C) 2024 the Eask authors. | ||
* | ||
* 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. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
exports.command = ['ecukes [files..]']; | ||
exports.desc = 'Run ecukes tests'; | ||
exports.builder = yargs => yargs | ||
.positional( | ||
'[files..]', { | ||
description: 'specify feature files to do ecukes tests', | ||
type: 'array', | ||
}); | ||
|
||
exports.handler = async (argv) => { | ||
await UTIL.e_call(argv, 'test/ecukes', argv.files); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
;;; test/ecukes.el --- Run ecukes tests -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Command to run ecukes tests, | ||
;; | ||
;; $ eask ecukes | ||
;; | ||
;; | ||
;; Positionals: | ||
;; | ||
;; [files..] specify feature files to do ecukes tests | ||
;; | ||
|
||
;;; Code: | ||
|
||
(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args))))) | ||
(load (expand-file-name "_prepare.el" | ||
(locate-dominating-file dir "_prepare.el")) | ||
nil t)) | ||
|
||
(defun eask-test-ecukes--run (files) | ||
"Run ecukes on FILES. | ||
Modified from function `ecukes-cli/run'." | ||
(ecukes-load) | ||
(ecukes-reporter-use ecukes-cli-reporter) | ||
(ecukes-run files)) | ||
|
||
(eask-start | ||
;; Preparation | ||
(eask-with-archives '("gnu" "melpa") | ||
(eask-package-install 'ecukes)) | ||
|
||
;; Start Testing | ||
(require 'ecukes) | ||
(let* ((patterns (eask-args)) | ||
(files (eask-expand-file-specs patterns))) | ||
(cond | ||
;; Files found, do the action! | ||
(files | ||
(eask-test-ecukes--run files)) | ||
;; Pattern defined, but no file found! | ||
(patterns | ||
(eask-msg "") | ||
(eask-info "(No files match wildcard: %s)" | ||
(mapconcat #'identity patterns " "))) | ||
;; Run default action. | ||
(t | ||
(ecukes))))) | ||
|
||
;;; test/ecukes.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(package "ecukes" | ||
"0.0.1" | ||
"Test project for command `ecukes'") | ||
|
||
(package-file "ecukes.el") | ||
|
||
(source 'gnu) | ||
(source 'melpa) | ||
|
||
(development | ||
(depends-on "ecukes")) | ||
|
||
(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432 |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (C) 2024 the Eask authors. | ||
|
||
# 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. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
## Commentary: | ||
# | ||
# Test command `ecukes` | ||
# | ||
|
||
set -e | ||
|
||
echo "Test command 'ecukes'..." | ||
cd $(dirname "$0") | ||
|
||
eask test ecukes | ||
eask test ecukes ./features/foo.feature |