Features

Install

npm install ready-test

Browser

To get up and running in the browser, link the included CSS/JS:

<html>
  <head>
    *<link rel="stylesheet" href="node_modules/ready-test/ready-test.css">*
  </head>
  <body>
    *<script src="node_modules/ready-test/ready-test.js"></script>*
  </body>
</html>

Then link your source files and tests:

<html>
  <head>
    <link rel="stylesheet" href="node_modules/ready-test/ready-test.css">
  </head>
  <body>
    <script src="node_modules/ready-test/ready-test.js"></script>
    *<script src="src/user.js"></script>*
    *<script src="test/userTest.js"></script>*
  </body>
</html>

The tests will run and output in the browser:

Browser Test Run

Node

In node, simply execute the script provided:

> npx ready-test

Or in npm versions below 5.2.0:

> ./node_modules/.bin/ready-test

The tests will run and output in the console:

Node Test Run

By default the runner will find tests like test/userTest.js, test/tests/user.js, spec/userSpec.js spec/specs/user.js etc.

You can also add it to your package.json file to run with npm test:

"scripts": {
  "test": "ready-test"
}

Usage

*describe('User', () => {*
  *it('should save', () => {*
    assertTrue(user.save());
    assertEqual(user.id, id);
  *});*
*});*
it('should save', () => {
  *assertTrue(user.save());*
  *assertEqual(user.id, id);*
});
*fit*('Focused test', () => {
*xit*('Skipped test', () => {
*fdescribe*('Focused suite', () => {
*xdescribe*('Skipped suite', () => {
it('should save', () => {
  *return user.save().then(() => {*
    assertEqual(user.id, id);
  *});*
});
it('should save', *async* () => {
  *await user.save();*
  assertEqual(user.id, id);
});
*beforeEach*(() => ...
*afterEach*(() => ...
*beforeAll*(() => ...
*afterAll*(() => ...

Other Features