9.2.0-next.1701827420.e9ec228bb187a4ea223ac00e3a6633323ba41d06 • Published 2 years ago

@bevry/testen v9.2.0-next.1701827420.e9ec228bb187a4ea223ac00e3a6633323ba41d06

Weekly downloads
3
License
Artistic-2.0
Repository
github
Last release
2 years ago

Run your tests locally against multiple node.js versions

@bevry/testen is a fork of testen which continues maintenance with various improvements and fixes.

Examples

Success

As JSON:

Failure

As JSON:

Usage

Complete API Documentation.

Testen uses nvm behind the scenes for its node.js version management.

Node.js Versions

The CLI will determine which Node.js versions to run your tests again in this order of most preferred first:

  • use the CLI via -n <version> flag (--node is also suitable):
    • testen -n 8.0.0 -n 10
    • testen -n '8 || 10'
    • testen -n '>=8 <=10'
  • use the package.json configuration file via:
    • "testen": { "node": ["8.0.0", 10] }
    • "testen": { "node": "8 || 10" }
    • "testen": { "node": ">=8 <=10" }
  • use the package.json configuration file via:
    • "testen": { "node": "8 || 10" }
    • "testen": { "node": ">=8 <=10" }
  • otherwise, the current, stable, and system versions are used which are resolved by nvm

Command

The 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:

  • use the CLI via -- <command>, e.g. testen -- echo hello world
  • use the package.json configuration file via "testen": { "serial": true }

Serial or Parallel

By default tests will run in parallel (multiple at once), to use serial, you can either:

  • use the CLI via -s flag (--serial is also suitable)
  • use the package.json configuration file via "testen": { "serial": true }

JSON Output

By default Testen will output pretty output, to only output the JSON result, you can either:

  • use the CLI via -j flag (--json is also suitable)
  • use the package.json configuration file via "testen": { "json": true }

Other CLI Flags

Refer to testen --help.

API Usage

Testen also provides an API which can be used like so:

const { Versions } = require('@bevry/testen')
async function main() {
    const versions = new Versions([4, 8, 10, 'current', 'stable', 'system'])
    await versions.load()
    await versions.install()
    await versions.test('npm test')
    console.log(versions.success)
}
main()

Complete API documentation is available.

npm

Discover the release history by heading on over to the HISTORY.md file.

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Unless stated otherwise all works are:

and licensed under: