Tiny, but fully loaded test-runner.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Muthu Kumar 19e52d87e6 [version] Updated docs and bumped version to 0.2.5 6 years ago
assets [docs] Added basic README & utility helpers 6 years ago
gunner [gunner] Option to add name to Gunner instance 6 years ago
util [runner] Fixed error on async func when expect is returned in promise 6 years ago
.eslintrc.js [docs] Added basic README & utility helpers 6 years ago
.gitignore [version] Updated docs and bumped version to 0.2.5 6 years ago
README.md [version] Updated docs and bumped version to 0.2.5 6 years ago
hello.txt [version] Updated docs and bumped version to 0.2.5 6 years ago
index.js [docs] Added basic README & utility helpers 6 years ago
package.json [version] Updated docs and bumped version to 0.2.5 6 years ago
sample.test.js [sample] Updated sample tests 6 years ago
shrinkwrap.yaml [init] MVP -- 6 years ago

README.md

Gunner

Django Unchained

Tiny, but fully loaded.

Gunner is a zero magic, fast test-runner and assertion framework. There are no magic globals or CLI specific interface.

Requirements & Usage

Gunner uses very modern JavaScript, and hence requires node 10+ currently.

Create a new Gunner instance and simply write your tests. The assertion methods are passed in as the callback to the test function.

const gunner = new Gunner();

gunner.test('arrays are equal', expect => {
	return expect([1, 2,]).deepEqual([1 ,2]);
});

gunner.run();

API

Gunner.constructor

Gunner#test(title, implementation)

Gunner#run(options)


new Gunner

Creates a new Gunner instance.

Options

  • name [default: undefined]: A name for this Gunner instance.

Usage

const gunner = new Gunner(options);

Gunner#test

Registers a new test. A test can have multiple expect statements. They should be returned as an array. The first expect to fail will cause the test to fail.

Usage

gunner.test('sum should equal 3', expect => {
	const sum = 1 + 2;
	return expect(sum).equal(3);
});

gunner.test('multiple expects should be true', expect => {
	const a = 1 + 2;
	const b = 'Hello World';

	return ([
		expect(a).equal(3),
		expect(b).equal('Goodbye World'),
	]);
});

Gunner#run

Starts running Gunner tests. Takes an options object as optional parameter.

Options

  • log [default: true]: Turn logs on or off (returns array of results)
  • trace [default: false]: Turn stack traces on or off

Usage

const options = { logs: true, trace: true };
gunner.run(options);