5.0.12 • Published 2 years ago

sarg v5.0.12

Weekly downloads
3
License
MIT
Repository
-
Last release
2 years ago

sarg

Simple unit testing runner that will travel through your files letting you know what happened. Simple, fast and with TypeScript definitions included!

Installation

The following approaches are valid:

npm install -g sarg
yarn add -D sarg
npm install --save-dev sarg

Usage

If you want detailed information about what each argument does, you can hit:

npx sarg --help

Create your test.js file

const assert = require('assert');
const reducer = require('./src/reducers/counter');
const { test } = require('sarg');

test('it should return initial state', function() {
    assert.equal(reducer(undefined, {}), 0);
});

test('it should increase counter', function() {
    assert.equal(reducer(0, reducer.increaseCounter()), 1);
});

test('it should decrease counter', function() {
    assert.equal(reducer(1, reducer.decreaseCounter()), 0);
});

test('it should not go lower than 0', function() {
    assert.equal(reducer(0, reducer.decreaseCounter()), 0);
});

Test it

npx sarg --watch test test.js

Test-Driven Development

The -w command will watch changes in files for you.

npx sarg -w test --ignore test/client-test.js "test/**/*.{js,tsx?}"

Usage with transpilers

You can use --require argument to load code that needs to be transpiled. It is an redundant argument so you can use how many compilers you need.

It works well with TypeScript and Babel register, you're free to use it together with no problem.

Babel

npx sarg \
    --require @babel/register \
    -w src/Tests/**/*.* test/**/*.{js,ts,tsx,jsx}

TypeScript

npx sarg \
    --require ts-node/register
    -w test
    test/**/*.{js,ts,tsx,jsx}

Reporters

Reporters are now available, you can easily extend the base reporter and create your own. Click here and create your first one.

5.0.9

2 years ago

5.0.8

2 years ago

5.0.7

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.10

2 years ago

5.0.0

2 years ago

5.0.11

2 years ago

5.0.12

2 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.6

4 years ago

4.0.3

4 years ago

3.0.2

4 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.11

5 years ago

2.0.10

6 years ago

2.0.9

6 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago