Clone of baretest with reporting
 
Go to file
Frédéric Matte e3c8fceb42 Use the default reporters 2023-09-30 04:59:01 -04:00
lib Use the default reporters 2023-09-30 04:59:01 -04:00
reporter The total is now in oneline 2022-12-30 13:54:11 -05:00
.gitignore First implementation of the metaltest 2022-11-08 22:29:58 -05:00
LICENSE Initial commit 2022-11-05 16:03:00 -04:00
README.md Add skip feature 2022-12-30 13:42:42 -05:00
index.js Move all code to lib folder 2022-12-05 17:07:06 -05:00
package-lock.json First implementation of the metaltest 2022-11-08 22:29:58 -05:00
package.json Add skip feature 2022-12-30 13:42:42 -05:00
suite.js Add test suite 2022-12-05 22:21:18 -05:00

README.md

metaltest

Clone of baretest with reporting

How to use

import assert from "node:assert/strict";
import metaltest from "metaltest";
const test = metaltest("Simple test");
test("test 1", () => {
  assert.equal(1, 1);
});
test("test 2", () => {
  assert.equal(2, 2);
});

const stats = await test.run();
/* Will return
{
  title: 'Metaltest',
  success: 2,
  fail: 0,
  skip: 0,
  total: 2,
  testSuccess: [],
  testFail: []
}
*/

How to report to the console

const stats = await test.run(consolereporter());

How to run only specific test or how to skip some test

import metaltest from "metaltest";
const test = metaltest("Simple test");
test.only("only this test will run", () => {
  assert.equal(1, 1);
});
test("this test will not run", () => {});
test.skip("this test will be skipped, even if there is no only", () => {});

How to create a suite of test

test.js

import assert from "node:assert/strict";
import metaltest from "metaltest";
const test = metaltest("Simple test");
test("test 1", () => {
  assert.equal(1, 1);
});
export { test };

suite.js

const { test } = await import("test.js");
await test.run(consolereporter());

Hot to easily run a suite of multiple test

suite.js

import { suite } from "metaltest";
await suite(); // Will run all test that are in the current folder recursively