UNPKG

13.3 kBMarkdownView Raw
1<!-- TITLE/ -->
2
3# @bevry/testen
4
5<!-- /TITLE -->
6
7<!-- BADGES/ -->
8
9<span class="badge-githubworkflow"><a href="https://github.com/bevry/testen/actions?query=workflow%3Abevry" title="View the status of this project's GitHub Workflow: bevry"><img src="https://github.com/bevry/testen/workflows/bevry/badge.svg" alt="Status of the GitHub Workflow: bevry" /></a></span>
10<span class="badge-npmversion"><a href="https://npmjs.org/package/@bevry/testen" title="View this project on NPM"><img src="https://img.shields.io/npm/v/@bevry/testen.svg" alt="NPM version" /></a></span>
11<span class="badge-npmdownloads"><a href="https://npmjs.org/package/@bevry/testen" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/@bevry/testen.svg" alt="NPM downloads" /></a></span>
12<br class="badge-separator" />
13<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
14<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/bevry" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span>
15<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
16<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
17<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
18<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
19<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
20<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
21<br class="badge-separator" />
22<span class="badge-discord"><a href="https://discord.gg/nQuXddV7VP" title="Join this project's community on Discord"><img src="https://img.shields.io/discord/1147436445783560193?logo=discord&amp;label=discord" alt="Discord server badge" /></a></span>
23<span class="badge-twitch"><a href="https://www.twitch.tv/balupton" title="Join this project's community on Twitch"><img src="https://img.shields.io/twitch/status/balupton?logo=twitch" alt="Twitch community badge" /></a></span>
24
25<!-- /BADGES -->
26
27<!-- DESCRIPTION/ -->
28
29Run your tests locally against multiple node.js versions
30
31<!-- /DESCRIPTION -->
32
33
34`@bevry/testen` is a fork of [testen](https://github.com/egoist/testen) which continues maintenance with various improvements and fixes.
35
36## Examples
37
38### Success
39
40<a href="https://asciinema.org/a/se1hXojsgeN4EJj0q2u0CRiQj?autoplay=1"><img src="https://asciinema.org/a/se1hXojsgeN4EJj0q2u0CRiQj.png" width="350" alt="success case"/></a>
41
42As JSON:
43
44<a href="https://asciinema.org/a/pRI8Q5oNkbt3vSVa1JXfMMyE4?autoplay=1&amp;speed=10"><img src="https://asciinema.org/a/pRI8Q5oNkbt3vSVa1JXfMMyE4.png" width="350" alt="success case as JSON"/></a>
45
46### Failure
47
48<a href="https://asciinema.org/a/T6TzRzu8R9ozEdsMkoAK1rjU5?autoplay=1&amp;speed=5"><img src="https://asciinema.org/a/T6TzRzu8R9ozEdsMkoAK1rjU5.png" width="350" alt="failure case"/></a>
49
50As JSON:
51
52<a href="https://asciinema.org/a/XnZasiO2HKi9wnXjd0LJgLjv7?autoplay=1&amp;speed=10"><img src="https://asciinema.org/a/XnZasiO2HKi9wnXjd0LJgLjv7.png" width="350" alt="failure case as JSON"/></a>
53
54## Usage
55
56[Complete API Documentation.](http://master.testen.bevry.surge.sh/docs/)
57
58Testen uses [nvm](https://github.com/creationix/nvm) behind the scenes for its node.js version management.
59
60### Node.js Versions
61
62The CLI will determine which Node.js versions to run your tests again in this order of most preferred first:
63
64- use the CLI via `-n <version>` flag (`--node` is also suitable):
65 - `testen -n 8.0.0 -n 10`
66 - `testen -n '8 || 10'`
67 - `testen -n '>=8 <=10'`
68- use the `package.json` configuration file via:
69 - `"testen": { "node": ["8.0.0", 10] }`
70 - `"testen": { "node": "8 || 10" }`
71 - `"testen": { "node": ">=8 <=10" }`
72- use the `package.json` configuration file via:
73 - `"testen": { "node": "8 || 10" }`
74 - `"testen": { "node": ">=8 <=10" }`
75- otherwise, the `current`, `stable`, and `system` versions are used which are resolved by nvm
76
77### Command
78
79The CLI will default to `npm test` as the command that will run for each Node.js version, however the API has no such default. You can customize this via:
80
81- use the CLI via `-- <command>`, e.g. `testen -- echo hello world`
82- use the `package.json` configuration file via `"testen": { "serial": true }`
83
84### Serial or Parallel
85
86By default tests will run in parallel (multiple at once), to use serial, you can either:
87
88- use the CLI via `-s` flag (`--serial` is also suitable)
89- use the `package.json` configuration file via `"testen": { "serial": true }`
90
91### JSON Output
92
93By default Testen will output pretty output, to only output the JSON result, you can either:
94
95- use the CLI via `-j` flag (`--json` is also suitable)
96- use the `package.json` configuration file via `"testen": { "json": true }`
97
98### Other CLI Flags
99
100Refer to `testen --help`.
101
102### API Usage
103
104Testen also provides an API which can be used like so:
105
106```javascript
107const { Versions } = require('@bevry/testen')
108async function main() {
109 const versions = new Versions([4, 8, 10, 'current', 'stable', 'system'])
110 await versions.load()
111 await versions.install()
112 await versions.test('npm test')
113 console.log(versions.success)
114}
115main()
116```
117
118[Complete API documentation is available.](http://master.testen.bevry.surge.sh/docs/)
119
120<!-- INSTALL/ -->
121
122## Install
123
124### [npm](https://npmjs.com "npm is a package manager for javascript")
125
126#### Install Globally
127
128- Install: `npm install --global @bevry/testen`
129- Executable: `@bevry/testen`
130
131#### Install Locally
132
133- Install: `npm install --save @bevry/testen`
134- Executable: `npx @bevry/testen`
135- Import: `import * as pkg from ('@bevry/testen')`
136- Require: `const pkg = require('@bevry/testen')`
137
138### [Editions](https://editions.bevry.me "Editions are the best way to produce and consume packages you care about.")
139
140This package is published with the following editions:
141- `@bevry/testen/source/index.ts` is [TypeScript](https://www.typescriptlang.org/ "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.") source code with [Import](https://babeljs.io/docs/learn-es2015/#modules "ECMAScript Modules") for modules
142- `@bevry/testen` aliases `@bevry/testen/edition-es2022-esm/index.js`
143- `@bevry/testen/edition-es2022-esm/index.js` is [TypeScript](https://www.typescriptlang.org/ "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.") compiled against [ES2022](https://en.wikipedia.org/wiki/ES2022 "ECMAScript 2022") for [Node.js](https://nodejs.org "Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine") 18 || 20 || 21 with [Import](https://babeljs.io/docs/learn-es2015/#modules "ECMAScript Modules") for modules
144- `@bevry/testen/edition-types/index.d.ts` is [TypeScript](https://www.typescriptlang.org/ "TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.") compiled Types with [Import](https://babeljs.io/docs/learn-es2015/#modules "ECMAScript Modules") for modules
145
146<!-- /INSTALL -->
147
148<!-- HISTORY/ -->
149
150## History
151
152[Discover the release history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/testen/blob/HEAD/HISTORY.md#files)
153
154<!-- /HISTORY -->
155
156<!-- BACKERS/ -->
157
158## Backers
159
160### Code
161
162[Discover how to contribute via the `CONTRIBUTING.md` file.](https://github.com/bevry/testen/blob/HEAD/CONTRIBUTING.md#files)
163
164#### Authors
165
166- 2018+ [Benjamin Lupton](https://balupton.com) — Accelerating collaborative wisdom.
167- 2016-2017 [EGOIST](https://egoist.dev) — Indie Hacker
168
169#### Maintainers
170
171- [Benjamin Lupton](https://balupton.com) — Accelerating collaborative wisdom.
172
173#### Contributors
174
175- [Benjamin Lupton](https://github.com/balupton) — [view contributions](https://github.com/bevry/testen/commits?author=balupton "View the GitHub contributions of Benjamin Lupton on repository bevry/testen")
176- [EGOIST](https://github.com/egoist) — [view contributions](https://github.com/bevry/testen/commits?author=egoist "View the GitHub contributions of EGOIST on repository bevry/testen")
177- [Greenkeeper](https://github.com/greenkeeperio-bot) — [view contributions](https://github.com/bevry/testen/commits?author=greenkeeperio-bot "View the GitHub contributions of Greenkeeper on repository bevry/testen")
178
179### Finances
180
181<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span>
182<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/bevry" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span>
183<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span>
184<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span>
185<span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span>
186<span class="badge-opencollective"><a href="https://opencollective.com/bevry" title="Donate to this project using Open Collective"><img src="https://img.shields.io/badge/open%20collective-donate-yellow.svg" alt="Open Collective donate button" /></a></span>
187<span class="badge-crypto"><a href="https://bevry.me/crypto" title="Donate to this project using Cryptocurrency"><img src="https://img.shields.io/badge/crypto-donate-yellow.svg" alt="crypto donate button" /></a></span>
188<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span>
189
190#### Sponsors
191
192- [Andrew Nesbitt](https://nesbitt.io) — Software engineer and researcher
193- [Balsa](https://balsa.com) — We're Balsa, and we're building tools for builders.
194- [Codecov](https://codecov.io) — Empower developers with tools to improve code quality and testing.
195- [Poonacha Medappa](https://poonachamedappa.com)
196- [Rob Morris](https://github.com/Rob-Morris)
197- [Sentry](https://sentry.io) — Real-time crash reporting for your web apps, mobile apps, and games.
198- [Syntax](https://syntax.fm) — Syntax Podcast
199
200#### Donors
201
202- [Andrew Nesbitt](https://nesbitt.io)
203- [Armen Mkrtchian](https://mogoni.dev)
204- [Balsa](https://balsa.com)
205- [Chad](https://opencollective.com/chad8)
206- [Codecov](https://codecov.io)
207- [dr.dimitru](https://veliovgroup.com)
208- [Elliott Ditman](https://elliottditman.com)
209- [entroniq](https://gitlab.com/entroniq)
210- [GitHub](https://github.com/about)
211- [Hunter Beast](https://cryptoquick.com)
212- [Jean-Luc Geering](https://github.com/jlgeering)
213- [Michael Duane Mooring](https://mdm.cc)
214- [Michael Harry Scepaniak](https://michaelscepaniak.com)
215- [Mohammed Shah](https://github.com/smashah)
216- [Mr. Henry](https://mrhenry.be)
217- [Nermal](https://arjunaditya.vercel.app)
218- [Pleo](https://pleo.io)
219- [Poonacha Medappa](https://poonachamedappa.com)
220- [Rob Morris](https://github.com/Rob-Morris)
221- [Robert de Forest](https://github.com/rdeforest)
222- [Sentry](https://sentry.io)
223- [ServieJS](https://github.com/serviejs)
224- [Skunk Team](https://skunk.team)
225- [Syntax](https://syntax.fm)
226- [WriterJohnBuck](https://github.com/WriterJohnBuck)
227
228<!-- /BACKERS -->
229
230<!-- LICENSE/ -->
231
232## License
233
234Unless stated otherwise all works are:
235
236- Copyright &copy; 2018+ [Benjamin Lupton](https://balupton.com)
237- Copyright &copy; 2016-2017 [EGOIST](https://egoist.dev)
238
239and licensed under:
240
241- [Artistic License 2.0](http://spdx.org/licenses/Artistic-2.0.html)
242
243<!-- /LICENSE -->