Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

testingrequired/t

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

t

A minimal test framework

Build

$ npm run build

Usage

Create a test file ./tests/example.test.js. Test files are modules that export a suite:

import suite from "@testingrequired/t";

export default suite(({ test, beforeEach }) => {
  let value;

  beforeEach(() => {
    value = 10;
  });

  test("Testing", _ => {
    _.assertEqual(10, value);
  });

  test.skip("Test will skip", _ => {
    _.assertEqual(10, value);
  });

  test.todo("Write this test");
});

The following functions are available in the suite callback: beforeEach, afterEach, beforeAll, afterAll, test, skip, todo

Test

The test function is passed an object with the properties: assert, assertEqual, spy.

Configuration

An optional configuration file .trc can be created:

{
  pattern?: string; // Test file glob pattern. Default: src/**/*.test.js
}

Running

$ npm run test

You can also override the configured test file pattern:

$ npm run test -- src/**/*.spec.js

About

A minimal test framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published