spooning-cli

Run tests defined with spooning

Usage no npm install needed!

<script type="module">
  import spooningCli from 'https://cdn.skypack.dev/spooning-cli';
</script>

README

spooning-cli

Package Version Install Size Coverage Status Dependencies

Run tests defined with spooning.

Sample Output

Styled Output

Install

npm install -D spooning spooning-cli

Requires node 6 or later. spooning-cli requires spooning as a peer dependency.

Usage

spoon [options] './test/**/*.test.js'

  --bail                # exit after first test failure
  --concurrency|-c N    # run tests in parallel, limit N (default: 1)
  --debug               # include stack trace in error output
  --no-style            # force plain style

Command Example

spoon --debug -c 10 './test/**/*.test.js'

If using glob features like ** (aka globstar), remember to put the pattern in quotes.

Specify multiple patterns to include files matched by any pattern.

Colors are enabled automatically if the environment supports them unless the --no-style flag is specified.

Test Definition Examples

Test definition files may call require('spooning') and define tests in their root scope or export a synchronous function that accepts a spooning parameter and defines tests when run.

const {it} = require('spooning');

it('Should pass', (callback) => {
    callback();
});

it('Should fail', (callback) => {
    callback(new Error('failed'));
});

or

module.exports = ({it}) => {

    it('Should pass', (callback) => {
        callback();
    });

    it('Should fail', (callback) => {
        callback(new Error('failed'));
    });
};

Note: If spooning-cli is installed globally (not recommended) test definition files MUST export a function and use the spooning instance passed to the function. If spooning-cli is installed as a project dependency, tests may export a function but it is optional.

Development

Clone the repository and run npm install in the project root.

Run Tests

npm test

The test script accepts the same arguments as the spoon command.

npm test -- --debug

Generate Coverage Reports

npm run cover

Occasionally, the text based report will show values less than 100% but not identify any offending line numbers. Use the npm run cover-html command to output a more detailed html-based coverage report to the .coverage directory.

Built With

Dependencies

  • glob — match files by glob pattern
  • minimist — parse command line arguments
  • supports-color — determine if colors are supported by the environment

Dev Dependencies

  • eslint — enforce consistent code style
  • nyc — generate test coverage reports
  • spooning — run unit tests

Contributing

Fork the repo and submit a pull request. Contributions must have 100% test coverage and adhere to the code style enforced by eslint.

Versioning

SemVer is used for versioning. For the versions available, see the tags on this repository.

Releasing

  1. Examine what will be included in the npm bundle:

     npm run pack
    

    The npm run pack command requires npm version 6.4.1 or later (because it uses the --dry-run flag). For older versions of npm, run tar -tvf "$(npm pack)" to list the contents of the generated tarball.

  2. Bump the version number in package.json and create a git tag:

     npm version patch
    

    The npm version command accepts a SemVer argument: <newversion>|major|minor|patch (where <newversion> is a standard version number, ex. 1.0.0).

  3. Publish a new version:

     npm publish
     git push origin master --tags
    

Author

Adam Jarret

License

This project is licensed under the MIT License. See the LICENSE.txt file for details.



🥄