Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(generate/test): Add command to setup test files #243

Merged
merged 5 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* feat(fmt): Add formatters (#232)
* feat(test): Add built-in `ecukes` test command (#236)
* fix: Don't pollute outer programs (#239)
* feat(generate/test): Add commands to setup test files (#243)

## 0.9.x
> Released Nov 17, 2023
Expand Down
38 changes: 38 additions & 0 deletions cmds/generate/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* 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 = ['test <type>'];
exports.desc = 'Generate test files based on the testing framework';
exports.builder = function (yargs) {
yargs.usage(`${exports.desc}

Usage: eask generate test <type> [options..]`)
.commandDir('./test/')
.demandCommand();

/* XXX: Configure only in the menu. */
if (UTIL.cmd_count() == 2) {
yargs.positional(
'<type>', {
description: 'type of the testing framework',
});
}
}

exports.handler = async (argv) => { };
25 changes: 25 additions & 0 deletions cmds/generate/test/buttercup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* 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 = ['buttercup'];
exports.desc = 'Create a new Buttercup setup for the project';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'generate/test/buttercup', argv.file);
};
25 changes: 25 additions & 0 deletions cmds/generate/test/ecukes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* 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'];
exports.desc = 'Create a new Ecukes setup for the project';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'generate/test/ecukes', argv.file);
};
31 changes: 31 additions & 0 deletions cmds/generate/test/ert-runner.js
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 = ['ert-runner [names..]'];
exports.desc = 'Create a new test project for the ert-runner';
exports.builder = yargs => yargs
.positional(
'[names..]', {
description: 'specify test names',
type: 'array',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'generate/test/ert-runner', argv.names);
};
31 changes: 31 additions & 0 deletions cmds/generate/test/ert.js
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 = ['ert [names..]'];
exports.desc = 'Create a new test project for the ert tests';
exports.builder = yargs => yargs
.positional(
'[names..]', {
description: 'specify test names',
type: 'array',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'generate/test/ert', argv.names);
};
53 changes: 45 additions & 8 deletions docs/content/Getting-Started/Commands-and-options/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,41 @@ $ eask [GLOBAL-OPTIONS] generate ignore <name>
to generate ignore file.
{{< /hint >}}

## 🔍 eask generate test ert

Create a new test project for the [ert][] tests.

```sh
$ eask [GLOBAL-OPTIONS] generate test ert [NAMES..]
```

## 🔍 eask generate test ert-runner

Create a new test project for the [ert-runner][].

```sh
$ eask [GLOBAL-OPTIONS] generate test ert-runner [NAMES..]
```

## 🔍 eask generate test buttercup

Create a new [Buttercup][] setup for the project.

```sh
$ eask [GLOBAL-OPTIONS] generate test buttercup
```

## 🔍 eask generate test ecukes

Create a new [Ecukes][] setup for the project.

```sh
$ eask [GLOBAL-OPTIONS] generate test ecukes
```

## 🔍 eask generate workflow circle-ci

Generate CircleCI workflow yaml file.
Generate [CircleCI][] workflow yaml file.

The default filename is `config.yml`.

Expand All @@ -523,7 +555,7 @@ This will generate the yaml file under `.circleci/`!

## 🔍 eask generate workflow github

Generate GitHub Actions workflow yaml file.
Generate [GitHub Actions][] workflow yaml file.

The default filename is `test.yml`.

Expand All @@ -535,7 +567,7 @@ This will generate the yaml file under `.github/workflow/`!

## 🔍 eask generate workflow gitlab

Generate GitLab Runner workflow yaml file.
Generate [GitLab Runner][] workflow yaml file.

The default filename is `.gitlab-ci.yml`.

Expand All @@ -545,7 +577,7 @@ $ eask [GLOBAL-OPTIONS] generate workflow gitlab [--file]

## 🔍 eask generate workflow travis-ci

Generate Travis CI workflow yaml file.
Generate [Travis CI][] workflow yaml file.

The default filename is `.travis.yml`.

Expand All @@ -559,23 +591,23 @@ Link between this package and a dependency on the local filesystem. A linked
dependency avoids the need to download a dependency from a remote archive. The
package linked to must either have a `Eask`-file or a `-pkg.el`-file.

## 🔍 eask link add <name> <path>
## 🔍 eask link add

Links the given *source* directory into the package directory of this project,
under the given *package* name.

```sh
$ eask [GLOBAL-OPTIONS] link add <name> <path>
$ eask [GLOBAL-OPTIONS] link add <NAME> <PATH>
```

## 🔍 eask link delete [name..]
## 🔍 eask link delete

Deletes the link for the given packages.

Alias: `remove`

```sh
$ eask [GLOBAL-OPTIONS] link delete [names..]
$ eask [GLOBAL-OPTIONS] link delete [NAMES..]
```

## 🔍 eask link list
Expand Down Expand Up @@ -1068,6 +1100,11 @@ Do not use a proxy for any URL matching pattern.
[Eldev]: https://emacs-eldev.github.io/eldev/
[Keg]: https://github.com/conao3/keg.el

[CircleCI]: https://circleci.com/
[GitHub Actions]: https://github.com/features/actions
[GitLab Runner]: https://docs.gitlab.com/runner/
[Travis CI]: https://www.travis-ci.com/

[ert]: https://www.gnu.org/software/emacs/manual/html_node/ert/
[ert-runner]: https://github.com/rejeep/ert-runner.el
[buttercup]: https://github.com/jorgenschaefer/emacs-buttercup
Expand Down
53 changes: 45 additions & 8 deletions docs/content/Getting-Started/Commands-and-options/_index.zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,41 @@ $ eask [GLOBAL-OPTIONS] generate ignore <name>
💡 此命令使用包 [gitignore-templates](https://github.com/xuchunyang/gitignore-templates.el) 生成忽略文件。
{{< /hint >}}

## 🔍 eask generate test ert

為 [ert][]測試建立一個新的測試項目。

```sh
$ eask [GLOBAL-OPTIONS] generate test ert [NAMES..]
```

## 🔍 eask generate test ert-runner

為 [ert-runner][] 建立一個新的測試項目。

```sh
$ eask [GLOBAL-OPTIONS] generate test ert-runner [NAMES..]
```

## 🔍 eask generate test buttercup

為專案建立一個新的 [Buttercup][] 設定。

```sh
$ eask [GLOBAL-OPTIONS] generate test buttercup
```

## 🔍 eask generate test ecukes

為專案創建一個新的 [Ecukes][] 設定。

```sh
$ eask [GLOBAL-OPTIONS] generate test ecukes
```

## 🔍 eask generate workflow circle-ci

生成 CircleCI 工作流 yaml 文件。
生成 [CircleCI][] 工作流 yaml 文件。

默認文件名為 `config.yml`。

Expand All @@ -512,7 +544,7 @@ $ eask [GLOBAL-OPTIONS] generate workflow circle-ci [--file]

## 🔍 eask generate workflow github

生成 GitHub Actions 工作流 yaml 文件。
生成 [GitHub Actions][] 工作流 yaml 文件。

默認文件名為 `test.yml`。

Expand All @@ -524,7 +556,7 @@ $ eask [GLOBAL-OPTIONS] generate workflow github [--file]

## 🔍 eask generate workflow gitlab

生成 GitLab Runner 工作流程 yaml 文件。
生成 [GitLab Runner][] 工作流程 yaml 文件。

默認文件名為 `.gitlab-ci.yml`。

Expand All @@ -534,7 +566,7 @@ $ eask [GLOBAL-OPTIONS] generate workflow gitlab [--file]

## 🔍 eask generate workflow travis-ci

生成 Travis CI 工作流 yaml 文件。
生成 [Travis CI][] 工作流 yaml 文件。

默認文件名為 `.travis.yml`。

Expand All @@ -547,22 +579,22 @@ $ eask [GLOBAL-OPTIONS] generate workflow travis-ci [--file]
此包與本地文件系統的依賴關係之間的鏈接。 鏈接的依賴項避免了從遠程存檔下載依賴項的需要。
鏈接到的包必須有一個 `Eask` 文件或一個 `-pkg.el` 文件。

## 🔍 eask link add <name> <path>
## 🔍 eask link add

將給定的 *source* 目錄鏈接到此項目的包目錄,在給定的 *package* 名稱下。

```sh
$ eask [GLOBAL-OPTIONS] link add <name> <path>
$ eask [GLOBAL-OPTIONS] link add <NAME> <PATH>
```

## 🔍 eask link delete [name..]
## 🔍 eask link delete

刪除給定包的鏈接。

別名: `remove`

```sh
$ eask [GLOBAL-OPTIONS] link delete [names..]
$ eask [GLOBAL-OPTIONS] link delete [NAMES..]
```

## 🔍 eask link list
Expand Down Expand Up @@ -1054,6 +1086,11 @@ $ eask --proxy "localhost:8888" [COMMAND]
[Eldev]: https://emacs-eldev.github.io/eldev/
[Keg]: https://github.com/conao3/keg.el

[CircleCI]: https://circleci.com/
[GitHub Actions]: https://github.com/features/actions
[GitLab Runner]: https://docs.gitlab.com/runner/
[Travis CI]: https://www.travis-ci.com/

[ert]: https://www.gnu.org/software/emacs/manual/html_node/ert/
[ert-runner]: https://github.com/rejeep/ert-runner.el
[buttercup]: https://github.com/jorgenschaefer/emacs-buttercup
Expand Down
Loading
Loading