npm: npm install @hapi/lab

yarn: yarn add @hapi/lab


lab is a simple test utility for Node.js. Unlike other test utilities, lab uses only async/await features and includes everything you should expect from a modern Node.js test utility. Our goal with lab is to keep the execution engine as simple as possible, and not try to build an extensible framework.

lab works best with the code assertion library but can be used with any assertion library that throws an error when a condition isn't met.


By default, lab loads all the '*.js' files inside the local 'test' directory and executes the tests found. To use different directories or files, pass the file or directories as arguments:

$ lab unit.js

Test files must require the lab module, and export a test script:

const Code = require('@hapi/code');
const Lab = require('@hapi/lab');

const { expect } = Code;
const { it } = exports.lab = Lab.script();

it('returns true when 1 + 1 equals 2', () => {

    expect(1 + 1).to.equal(2);


const Code = require('@hapi/code');
const Lab = require('@hapi/lab');

const { expect } = Code;
const lab = exports.lab = Lab.script();

lab.test('returns true when 1 + 1 equals 2', () => {

    expect(1 + 1).to.equal(2);

If a test is performing an asynchronous operation then it should use the async / await keywords or return a Promise. For example:

lab.test('config file has correct value', async () => {

    const file = await fs.readFile('config');

Tests can be organized into experiments:

lab.experiment('math', () => {

    lab.test('returns true when 1 + 1 equals 2', () => {

        expect(1 + 1).to.equal(2);

If you need to perform some setup operations before or after executing the tests inside an experiment, the before() and after() methods can be used. To execute code before or after each test in an experiment, use beforeEach() and afterEach().

lab.experiment('math', () => {

    lab.before(() => {

        return new Promise((resolve) => {

            // Wait 1 second
            setTimeout(() => {

            }, 1000);

    lab.beforeEach(() => {

        // Run before every single test

    lab.test('returns true when 1 + 1 equals 2', () => {

        expect(1 + 1).to.equal(2);

test(), before(), beforeEach(), after() and afterEach() also support returning promises just as tests do:

lab.experiment('math', () => {

    lab.before(() => {

        return aFunctionReturningAPromise();

    lab.test('returns true when 1 + 1 equals 2', () => {

        return aFunctionReturningAPromise()
            .then((aValue) => {


Both test() and experiment() accept an optional options argument which must be an object with the following optional keys:

  • timeout - set a test or experiment specific timeout in milliseconds. Defaults to the global timeout (2000ms or the value of -m).
  • skip - skip execution. When used on an experiment, all children will be skipped - even if they are marked with only.
  • only - marks all other tests or experiments with skip.

You can also append .only(…) or .skip(…) to test and experiment instead of using options:

lab.experiment('with only', () => {

    lab.test.only('only this test will run', () => {

        expect(1 + 1).to.equal(2);

    lab.test('another test that will not be executed', () => {});

Behavior Driven Development

To make lab look like BDD:

const Code = require('@hapi/code');
const Lab = require('@hapi/lab');

const { expect } = Code;
const { after, before, describe, it } = exports.lab = Lab.script();

describe('math', () => {

    before(() => {});

    after(() => {});

    it('returns true when 1 + 1 equals 2', () => {

        expect(1 + 1).to.equal(2);

Test Driven Development

To make lab look like TDD:

const Code = require('@hapi/code');
const Lab = require('@hapi/lab');

const { expect } = Code;
const { suite, test } = exports.lab = Lab.script();

suite('math', () => {

    test('returns true when 1 + 1 equals 2', () => {

        expect(1 + 1).to.equal(2);

Best practices

  • Add lab as a dev dependency to your project's package.json along with a test script:
  "devDependencies": {
    "lab": "21.x.x"
  "scripts": {
    "test": "lab -t 100",
    "test-cov-html": "lab -r html -o coverage.html"

Note that npm test will execute lab with the -t 100 option which will require 100% code coverage. Run npm run test-cov-html and check the coverage.html file to figure out where coverage is lacking. When coverage is below the threshold, the CLI will exit with code 1 and will result in an npm Error message.

  • Run your tests with
$ npm test


before(), after(), beforeEach(), afterEach() accept an optional options argument which must be an object with the following optional keys:

  • timeout - set a specific timeout in milliseconds. Disabled by default or the value of -M.
lab.experiment('math', { timeout: 1000 }, () => {

    lab.before({ timeout: 500 }, () =>  {


    lab.test('returns true when 1 + 1 equals 2', () =>  {

        expect(1 + 1).to.equal(2);


To use source transforms, you must specify a file with the -T command line option that tells Lab how to do the transformation. You can specify many extensions with different transform functions such as .ts or .jsx.


A TypeScript definition file is included with lab to make it easier to use inside of an existing TypeScript project. Below is a TypeScript test example that uses the lab-transform-typescript module to manage the transform:

import * as Lab from 'lab';
import { expect } from '@hapi/code';

const lab = Lab.script();
const { describe, it, before } = lab;
export { lab };

describe('experiment', () => {

    before(() => {});

    it('verifies 1 equals 1', () => {


Then the test can be executed using the following command line:

$ lab --sourcemaps --transform node_modules/lab-transform-typescript

Command Line

lab supports the following command line options:

  • -a, --assert - name of assert library to use. To disable assertion library set to false.
  • --bail - terminate the process with a non-zero exit code on the first test failure. Defaults to false.
  • -c, --coverage - enables code coverage analysis.
  • --coverage-path - sets code coverage path.
  • --coverage-exclude - sets code coverage excludes.
  • --coverage-all - report coverage for all matched files, not just those tested.
  • --coverage-flat - do not perform a recursive find of files for coverage report. Requires --coverage-all
  • --coverage-pattern - only report coverage for files with the given pattern in the name. Defaults to pattern. Requires --coverage-all
  • -C, --colors - enables or disables color output. Defaults to console capabilities.
  • -d, --dry - dry run. Skips all tests. Use with -v to generate a test catalog. Defaults to false.
  • -e, --environment - value to set the NODE_ENV environment variable to, defaults to 'test'.
  • -f, --flat - do not perform a recursive load of test files within the test directory.
  • -g, --grep - only run tests matching the given pattern which is internally compiled to a RegExp.
  • -h, --help - show command line usage.
  • -i, --id - only run the test for the given identifier (or identifiers range, e.g. lab -i 1-3,5). Use lab -dv to print all tests and their identifier without running the tests. This is an alias of ids array property in .labrc file.
  • -I, --ignore - ignore a list of globals for the leak detection (comma separated), this is an alias of globals property in .labrc file. To ignore symbols, pass the symbol's string representation (e.g. Symbol(special)).
  • --inspect - start lab in debug mode using the V8 Inspector.
  • --inspect-brk - see --inspect.
  • -l, --leaks - disables global variable leak detection.
  • -L, --lint - run linting rules using linter. Disabled by default.
  • --lint-errors-threshold - maximum absolute amount of linting errors. Defaults to 0.
  • --lint-warnings-threshold - maximum absolute amount of linting warnings. Defaults to 0.
  • --lint-fix - apply any fixes from the linter, requires -L or --lint to be enabled. Disabled by default.
  • --lint-options - specify options to pass to linting program. It must be a string that is JSON.parse(able).
  • -m, --timeout - individual tests timeout in milliseconds (zero disables timeout). Defaults to 2 seconds.
  • -M, --context-timeout - default timeouts for before, after, beforeEach and afterEach in milliseconds. Disabled by default.
  • -o, --output - file to write the report to, otherwise sent to stdout.
  • -p, --default-plan-threshold - sets the minimum number of assertions a test must run. Overridable with plan.
  • -P, --pattern - only load files with the given pattern in the name.
  • -r, --reporter - the reporter used to generate the test results. Defaults to console. Options are:
    • console - text report.
    • html - HTML test and code coverage report (sets -c).
    • json - output results in JSON format.
    • junit - output results in JUnit XML format.
    • tap - TAP protocol report.
    • lcov - output to lcov format.
    • clover - output results in Clover XML format.
    • Multiple Reporters - See Below
    • Custom Reporters - See Below
  • --shuffle - randomize the order that test scripts are executed. Will not work with --id.
  • --seed - use this seed to randomize the order with --shuffle. This is useful to debug order dependent test failures.
  • -s, --silence - silence test output, defaults to false.
  • -S, --sourcemaps - enables sourcemap support for stack traces and code coverage, disabled by default.
  • -t, --threshold - sets the minimum code test coverage percentage to 100%.
  • --types-test - sets a single TypeScript definition test file (implies -Y). Use when the test directory contains other TypeScript files that should not be loaded for definition testing.
  • -T, --transform - javascript file that exports an array of objects ie. [ { ext: ".js", transform: (content, filename) => { ... } } ]. Note that if you use this option with -c (--coverage), then you must generate sourcemaps and pass sourcemaps option to get proper line numbers.
  • -v, --verbose - verbose test output, defaults to false.
  • -V, --version - display lab version information.
  • -Y, --types - validate the module TypeScript types definitions. This is designed exclusively for JavaScript modules that export a TypeScript definition file.



Generates a test script interface which is used to add experiments and tests, where:

  • options - an optional object with the following optional keys:
    • schedule - if false, an automatic execution of the script is disabled. Automatic execution allows running lab test scripts directly with Node.js without having to use the CLI (e.g. node test/script.js). When using lab programmatically, this behavior is undesired and can be turned off by setting schedule to false. If you need to see the output with schedule disabled you should set output to process.stdout. Defaults to true.
    • cli - allows setting command line options within the script. Note that the last script file loaded wins and usage of this is recommended only for temporarily changing the execution of tests. This option is useful for code working with an automatic test engine that run tests on commits. Setting this option has no effect when not using the CLI runner. For example setting cli to { ids: [1] } will only execute the first test loaded.

script.after([options], action)

Executes the provided action after the current experiment block is finished where:

  • options - optional flags as describe in script.test().
  • action - a sync or async function using the signature function(flags) where:


Executes the provided action after each test is executed in the current experiment block where:

  • options - optional flags as describe in script.test().
  • action - a sync or async function using the signature function(flags) where:


Executes the provided action before the current experiment block is started where:

  • options - optional flags as describe in script.test().
  • action - a sync or async function using the signature function(flags) where:


Executes the provided action before each test is executed in the current experiment block where:

  • options - optional flags as describe in script.test().
  • action - a sync or async function using the signature function(flags) where:

script.describe(title, [options], content)

Same as script.experiment().

script.experiment(title, [options], content)

Sets up an experiment (a group of tests) where:

  • title - the experiment description.
  • options - optional settings:
    • skip - if true, sets the entire experiment content to be skipped during execution. Defaults to false.
    • only - if true, sets all other experiments to skip. Default to false.
    • timeout - overrides the default test timeout for tests and other timed operations. Defaults to 2000.
  • content - a function with signature function() which can setup other experiments or tests.

script.experiment.only(title, [options], content)

Same as script.experiment() with the only option set to true.

script.experiment.skip(title, [options], content)

Same as script.experiment() with the skip option set to true., [options], test)

Same as script.test().

script.suite(title, [options], content)

Same as script.experiment().

script.test(title, [options], test)

Sets up a test where:

  • title - the test description.
  • options - optional settings:
    • skip - if true, sets the entire experiment content to be skipped during execution. Defaults to false.
    • only - if true, sets all other experiments to skip. Default to false.
    • timeout - overrides the default test timeout for tests and other timed operations in milliseconds. Defaults to 2000.
    • plan - the expected number of assertions the test must execute. This setting should only be used with an assertion library that supports a count() function, like code.
  • test - a function with signature function(flags) where:
    • the function can throw if the test failed.
    • the function can return a Promise which either resolves (success) or rejects (fails).
    • all other return value is ignored.
    • flags - a set of test utilities described in Flags.
lab.experiment('my plan', () => {

    lab.test('only a single assertion executes', { plan: 1 }, () => {

        expect(1 + 1).to.equal(2);

script.test.only(title, [options], test)

Same as calling script.test() with only option set to true.

script.test.skip(title, [options], test)

Same as calling script.test() with skip option set to true.


The test function is passed a flags object that can be used to create notes or set a function to execute for cleanup operations after the test is complete.


An object that is passed to before and after functions in addition to tests themselves. context is used to set properties inside the before function that can be used by a test function later. It is meant to reduce module level variables that are set by the before / beforeEach functions. Tests aren't able to manipulate the context object for other tests.

lab.before(({ context }) => { = 'bar';

lab.test('contains context', ({ context }) => {


mustCall(func, count)

Sets a requirement that a function must be called a certain number of times where:

  • func - the function to be called.
  • count - the number of required invocations.

Returns a wrapped copy of the function. After the test is complete, each mustCall assertion will be checked and the test will fail if any function was called the incorrect number of times.

Below is an example demonstrating how to use mustCall to verify that fn is called exactly two times.

lab.test('fn must be called twice', async (flags) => {

    const fn = () => {};
    const wrapped = flags.mustCall(fn, 2);

    await doSomeAsyncOperation();


Adds notes to the test log where:

  • note - a string to be included in the console reporter at the end of the output.

For example, if you would like to add a note with the current time, your test case may look like the following:

lab.test('attaches notes', (flags) => {

    expect(1 + 1).to.equal(2);
    flags.note(`The current time is ${}`);

Multiple notes can be appended for the same test case by simply calling note() repeatedly.


A property that can be assigned a cleanup function registered at runtime to be executed after the test completes. The cleanup function will execute even in the event of a timeout or error. Note that the cleanup function will be executed as-is without any timers. The function assigned to onCleanup can return a Promise that will be evaluated.

lab.test('cleanups after test', (flags) => {

    flags.onCleanup = () => {


    expect(1 + 1).to.equal(2);


A property that can be assigned an override for global exception handling. This can be used to test the code that is explicitly meant to result in uncaught exceptions.

lab.test('leaves an uncaught rejection', (flags) => {

    return new Promise((resolve) => {

        flags.onUncaughtException = (err) => {

            expect(err)'I want this exception to remain uncaught in production');
            resolve(); // finish the test

        // sample production code
        setTimeout(() => {

            throw new Error('I want this exception to remain uncaught in production');


A property that can be assigned an override function for global rejection handling. This can be used to test the code that is explicitly meant to result in unhandled rejections.

lab.test('leaves an unhandled rejection', (flags) => {

    return new Promise((resolve) => {

        flags.onUnhandledRejection = (err) => {

            expect(err)'I want this rejection to remain unhandled in production');
            resolve(); // finish the test

        // sample production code
        setTimeout(() => {

            Promise.reject(new Error('I want this rejection to remain unhandled in production'));

.labrc.js File

lab supports a .labrc.js configuration file for centralizing lab settings. The .labrc.js file can be located in the current working directory, any directory that is the parent of the current working directory, or in the user's home directory. The .labrc.js file needs to be able to be required by Node.js. Therefore, either format it as a JSON file or with a module.exports that exports an object with the keys that are the settings.

Below is an example of a .labrc.js file to enable linting and test coverage checking:

module.exports = {
    coverage: true,
    threshold: 90,
    lint: true

Setting precedent

The .labrc.js file will override the lab default settings. Any options passed to the lab runner will override the settings found in .labrc.js. For example, assume you have the following .labrc.js file:

module.exports = {
    coverage: true,
    threshold: 100

If you need to reduce the coverage threshold for a single run, you can execute lab as follows:

lab -t 80

Available settings

The .labrc.js file supports configuration keys that are named with the long name of the command line settings. Therefore, if you need to specify an assert library, you would export a key named "assert" with the desired value.

In addition, you can use the paths parameter to override the default test directory (i.e. ./test):

module.exports = {
    paths: ['test/lab'],

As stated at the beginning of the document, --ignore parameter is an alias for globals option in the .labrc file. Therefore if you wish to ignore specific files you'll need to append a globals setting, not an ignore one, as stated on #641.


lab uses a shareable eslint config, and a plugin containing several hapi specific linting rules. If you want to extend the default linter you must:

  1. Add eslint-plugin-hapi and eslint-config-hapi as dependencies in your package.json. You must add both the plugin and the config because eslint treats them as peer dependencies. For more background, see eslint/eslint#3458 and eslint/eslint#2518.

  2. In your project's eslint configuration, add "extends": "eslint-config-hapi". eslint will automatically infer the eslint-config-, so technically you can just write "extends": "hapi".

Your project's eslint configuration will now extend the default lab configuration.

Ignoring files in linting

Since eslint is used to lint, you can create an .eslintignore containing paths to be ignored:


Only run linting

In order to run linting and not to execute tests you can combine the dry run flag with the lint flag.

lab -dL

Integration with an assertion library

Using the --assert argument allows you to integrate Lab with your favorite assertion library. Aside from --assert from the CLI you can change the assert option when executing report. Whatever assertion library you specify is imported and assigned to the Lab.assertions property. Here is an example using lab --assert code:

const lab = exports.lab = Lab.script();
const { describe, it } = lab;

// Testing shortcuts
const { expect, fail } = require('@hapi/code');

describe('expectation', () => {

    it('should be able to expect', () => {


    it('should be able to fail (This test should fail)', () => {

        fail('Should fail');
$ lab --assert code

If you use the Code assertion library Lab will let you know if you have any missing assertions. An example of this is:

describe('expectation', () => {

    it('Test should pass but get marked as having a missing expectation', () => {

        // Invalid and missing assertion - false is a method, not a property!
        // This test will pass.

This is an invalid test but it will pass as the .false assertion was not actually called. Lab will report the number of incomplete assertions, their location in your code and return a failure of the tests.

Similarly, if you use an assertion library, lab will be able to report the verbosity of your tests. This is a measure of the number of assertions divided by the number of tests. The value will be output when using the console reporter and can be helpful in determining if too many or too few assertions exist in each test. What is too many or too few assertions is entirely up to you.


lab can be started with the option --inspect which will run it with the V8 Inspector.

This debugger can be accessed using the URL that is printed in the console, or used in association with a few Chrome extensions (Node.js V8 Inspector, NIM, etc).

As you may know, if your tests are associated with the command npm test, you can already run npm test -- --inspect to run it with the inspector and avoid creating another command. If you want to listen on a specific port for the inspector, pass --inspect={port}.

lab also has automatic support for the WebStorm debugger, just start a normal debugging session on your npm test script.

Multiple Reporters

Multiple reporters can be specified by providing multiple reporter options.

$ lab -r console -r html

If any output -o is provided, they must match the same number of provided reporter options. The reporters would be paired with an output based on the order in which they were supplied. When specifying multiple outputs, use stdout to send a particular reporter to stdout.

$ lab -r console -o stdout -r html -o coverage.html -r lcov -o -r json -o data.json

In a .labrc.js file, multiple reporters and their associated output paths would be represented as follows:

module.exports = {
    reporter: ['console', 'html', 'lcov', 'json'],
    output: ['stdout', 'coverage.html', '', 'data.json']

Multiple reporters of the same kind are also supported.

$ lab -r console -o stdout -r console -o console.log

Custom Reporters

If the value passed for reporter isn't included with Lab, it is loaded from the filesystem. If the string starts with a period ('./custom-reporter'), it will be loaded relative to the current working directory. If it doesn't start with a period ('custom-reporter'), it will be loaded from the node_modules directory, just like any module installed using npm install.

Reporters must be a class with the following methods: start, test and end. options are passed to the class constructor upon initialization.

See the json reporter for a good starting point.


Sometimes you want to disable code coverage for specific lines, and have the coverage report omit them entirely. To do so, use the $lab:coverage:(off|on)$ comments. For example:

// There is no way to cover this in node 0.10
/* $lab:coverage:off$ */
if (typeof value === 'symbol') {
    // do something with value
/* $lab:coverage:on$ */

Coverage Bypass Stack

Disabling code coverage becomes tricky when dealing with machine-generated or machine-altered code. For example, babel can be configured to disable coverage for generated code using the auxiliaryCommentBefore and auxiliaryCommentAfter options. The naïve approach to this uses $lab:coverage:on$ and $lab:coverage:off$, but these directives overwrite any user-specified directives, so that a block where coverage should be disabled may have that coverage unintentionally re-enabled. To work around this issue, lab supports pushing the current code coverage bypass state onto an internal stack using the $lab:coverage:push$ directive, and supports restoring the top of the stack using the $lab:coverage:pop$ directive:

// There is no way to cover this in node < 10.0.0
/* $lab:coverage:off$ */
const { types } = Util;
const isSet = (types && types.isSet) || (set) => set instanceof Set;
/* $lab:coverage:on$ */

// When Util is imported using import and babel transpiles to cjs, babel can be
// configured to use the stack:
/* $lab:coverage:off$ */
const {
} =
const isSet = types && types.isSet || (set) => set instanceof Set;
/* $lab:coverage:on$ */


  • $lab:coverage:push$ copies the current skip state to the top of the stack, and leaves it as the current state as well
  • $lab:coverage:pop$ replaces the current skip state with the top of the stack, and removes the top of the stack
    • if the stack is empty, lab will tell you by throwing the error "unable to pop coverage bypass stack"

Excluding paths from coverage reporting

The --coverage-exclude argument can be repeated multiple times in order to add multiple paths to exclude. By default the node_modules and test directories are excluded. If you want to exclude those as well as a directory named public you can run lab as follows:

lab -c --coverage-exclude test --coverage-exclude node_modules --coverage-exclude public


lab initial code borrowed heavily from mocha, including the actual code used to render the coverage report into HTML. lab coverage code was originally adapted from blanket which in turn uses falafel.


breaking changes
Update types
Drop node 8
Tags to skip types test line execution
coverage-all option triggers TypeError: Cannot set property 'source' of undefined
Fails to load npm modules in ts tests
Support types test execution on windows
External modules coverage fails on windows due to path
Run TS tests, not just validate them
New diff is broken
coverage analysis modifies a function return
Stupid typescript
Support coverage of external modules with own coverage reports
Ignore symbol leaks
Update to eslint 6
Single line coverage ignore
Implement coverage bypass stack
Support multiple "only" flags
Support for multiple "only"
Add affordance for coverage flag stack
Handle ts "Cannot find name" error when expected
19.0.0 Release Notes
Change console reporter labels
Typescript test support
Remove debug-brk
Global leak detector skips Symbol() properties
Use util.inspect() for console reporter
"console" reporter crashes if object contains a BigInt
No mismatch highlighted on -0 !== 0 deep equality mismatch
Update lint rules modules
Add globalThis to symbols
Update code
Change module namespace
Update deps
Switch back to Hoek.clone from lodash.deepClone.
Fix coverage with sourcemaps inlined via Transform API.
breaking changes
Properly propagate term sig to child lab process
Add note about how to get a tests ID
Update eslint version
Remove deprecated espree option
Remove docs about custom linter option
Compare coverage pattern to canonical path
Centralize espree options
Remove old parallel flag from test
Use correct gray color code
Add missing coverage and remove unnecessary checks
Fix false-positive coverage of if statements (REDUCES REPORTED COVERAGE!)
Update linter configuration?
Console reporter: "gray" is actually light green
Coverage fails for multiple conditionals on same line (logical operators)
Documentation on using --id
Request to consolidate parsers
CLI failure test doesn't appear to test what it claims
Add coverage-pattern option
Remove engines
Coverage being analized on the test file
Check file pattern on coverage traversal
Add --coverage-all option
setting coverage-path doesn't include all code in path
Update dependencies
Revert console cov report truncation
Improve console coverage report readability
Update hoek v6
Fails to handle non-Error errors
Update type definitions to match documented API
[ENHANCEMENT] Nullified test context on finish to prevent memory leaks
Possible context memory leak?
No longer skip scripts when multiple only
breaking changes
Add node 11 to travis
handle queueMicrotask global added in Node 11
Add testsuites output to junit
Upgrade source-map and support limited sourcemap descriptors
Fixed skipped console output color
Only is no longer limited to 1 test
junit report generated has both classname and the name as "classname + ' ' + name".
html reporter errors when encountering sourcemap chunks with typescript
Update ecmaversion in eslint
Fix stack trace trimming
Document `paths` parameter in .labrc.js
breaking changes
Update to eslint v5
Disable dep timeout, which is doc default
Allow custom handling for global errors/rejections
update eslint-config-hapi dependency
Disable "uncaughtException" handler for tests
-M, --context-timeout is ignored; test passed even it is not triggered
Support test context from befores
Add BigInt globals
Update coverage ECMA version to 9 (2018).
Add WHATWG Encoding API globals
Revert "Wait for stdout to stop writing to exit"
Wait for stdout to stop writing to exit
Calculate relative filename using node's path
Transforming files does not work with yarn workspaces
Fix coverage on transformed files. Fixes #826.
Update eslint
Ignore default-plan-threshold for anything else than tests
Implement minimum assertions threshold. Closes #690.
Allow to specify minimum number of executed assertions
Bump diff to 3.5
Update eslint dep
Fail test if a falsy value is thrown by the test
awaiting a rejected promise can still pass test
Can exclude files from coverage
Write CLI errors to stderr
Update eslint version
add URL and URLSearchParams to global variables
Missing exports.lab causes error when generating html coverage report
Report correct exit code with multiple reporters
Add multiple reporter tests
Update eslint version
Using multiple reporters results into wrong exit code if test fails
Update eslint
Support object rest/spread under eslint
update to use expect from code
Update TypeScript typings
Fix usage example of flags.onCleanup
Added index.d.ts to npmignore
Add mustCall feature
Updated readme to include alias of ignore
ignore setting not supported in .labrc.js
Fix for node 9
Remove outdated assert statements
assertion library "code" is not set by default / documentation is wrong
New globals are coming
Fix test script error duplicates
Update eslint
Remove code as default assertion library. Resolves #771
Display parser errors when requiring scripts
15.0.0 Release Notes
Remove domains and callbacks
Use of onCleanup() when test returns a promise
Remove domains in favor of try/catch on async/await
Bump diff to 3.5 (v14.x.x)
Fix for node 9
Update deps: eslint, source-map
Helpful message when path not found
More helpful message when test path not found
Fix RangeError for --id when skipping a large number of tests
update eslint parser version to 8
#647 add example of multiple reporters in .labrc.js
Update deps: eslint/supports-color
Better color detection
Document verbosity value
Fix readme linting issues
add object spread option
Coverage is broken when using object spread operator
Please add an explanation of verbosity; what does 'verbosity: 3.00' mean?
Document definition file
Add TypeScript definition file
Typescript support
Update dependencies: eslint, espree
Be explicit about errors thrown in before/afters
Help: Multiple callbacks error with mongo AND lab.before
Fix failing test
Fix npm 5.2 error
Expose Code features directly on script
Failed befores properly fail related tests
Fail conditions documentation is unclear
Support eslint 4 ignore path
14.0.0 Release Notes
Error on tests with both promise and callback
Update eslint/code versions
Upgrade to ESLint v4
Bundle code as default assertion library
Include code assertion library
Confusing warning when mixing Promise and callback style
Update espree version
upgrade eslint to 3.19.x
Error when doing code coverage: "ecmaVersion must be 3, 5, 6, or 7."
Add WebAssembly to allowed globals
Node 8 will add `WebAssembly` global
Ignore while a promise returns inside a test with a value. Only watch for rejection
Promises that return values now error on finished
Fix a domain leak and onCleanup failures
Improve bail strategy not to execute next befores/afters
Extending linting
plan and Lab.assertions not working
Fix test
Add failing test for conditional value
Fix coverage of zero-comment scripts
TypeError: Reduce of empty array with no initial value
13.0.0 Release Notes
Minor cleanup
Reduce leaked memory via domains and timers
Update eslint version
Original files in HTML reporter
Test coverage shows untransformed output
Typos and inspect supports port
Add support for Node.js and WebStorm debuggers
Implement --inspect so debugging inside a test is possible?
12.0.0 Release Notes
Add --bail support
upgrade espree parser to use ECMAScript latest 8
.labrc.js with --harmony options execute failed
cli `--help` command showing incorrect commands
Stop Tests On First Failure
Update eslint
Fix test and deprecation warning
Update eslint version
fix: don't show seed when shuffle was not enabled
Node 7, update deps
Added a flag (-R, --rejections) to make the test fail if an unhandled Promise rejection happened during its execution
feat: allow to set the seed for --shuffle with --seed.
when tests fail with `--shuffle`, how to run tests in the failing order?
Update eslint to 3.9.x
fixes logic for lab.before timeout #652
disable lab before timeout
Make the test fail on a Promise unhandled rejection
Update deps: eslint, diff
Update eslint
fixing invalid markup on filter checkboxes
Docs: Fix URL in
Docs: Added documentation for the assert argument
The `assert` command line flag should be properly documented
Disable debug mode by default
Failed tests reported twice
11.0.0 Release Notes
Test entire node range before bypassing
Update eslint dep
Ensure we're not bypassing loc that should be covered
update to eslint-config-hapi@10.x.x
`/* `$lab:coverage:(off|on)$` */` disables coverage for a whole module
Upgrade eslint to v3
labrc.js can override all cli options
closes #610
Upgrade to eslint@2.13.x
some options can't be configured with .labrc.js
Fix NODE_ENV not being set (fixes #606)
NODE_ENV is no longer defaulting to 'test'
Display a warning for failed patterns
Show better error message when -P fails to find matching patterns
Support .labrc.js for configuration
Cleanup leak harmony checks
Support .labrc files for configuration defaults
Add space after failed test x
Adjust gray to comply with solarized dark theme
Update eslint to v2.10.x
Cleanup lint-fix setting
Support ability to add notes to a test
Add --lint-fix option.
Add ability to attach notes to test results
Update to code v3
Make coverage excludes more explicit
Support the same test name in diff experiments
File Name Coverage Issue
Experiment description not showing in output
Default output to stdout
Document how to only run linting
Don't execute before/after on experiments that lack tests
Better documentation for schedule
Run linting only
before and after blocks
Enable output for single-file usage
Skipped tests should have their beforeEach() skipped too?
self-run scripts don't generate output or respect CLI arguments
Promise test check should allow more than one argument
Post test cleanup. Closes #577
Post test cleanup
Support bossy 3
Update dependencies
id-557: Error thrown when I use --coverage-exclude
use stable stringify for better objects diff
Error thrown when I use --coverage-exclude
Works correctly with node v6
Add Reflect to whitelist
leaks detected:Reflect using node v6.0.0
Code coverage: Always surround expressions in ternary operator with parenthesis
Code coverage for conditional operator with comma operator isn't handled correctly
Update eslint to v2.5
Update deps and fix flushing to stdout
Feature/silent skips
Allow stdout to flush
Add `plan` option for tests
Set expected number of assertions
Feature: promises
Support promises in tests and setup / teardown
Fix "multiple only" error with multiple outputs
Update readme for global only
10.0.0 Release Notes
Global "only" (#524)
Add a global `only` flag to improve TDD experience
Support shuffling execution of scripts
9.0.0 Release Notes
Remove jslint and support custom linters
Add JavaScript Standard Style (`standard`) as a linter option
Make linter pluggable? (PR offer)
Fix coverage of trailing function declaration
Fix coverage report for single-line functions and single-expression arrow functions
Single line functions are not property tested for coverage
update to eslint@2.x.x
upgrade to espree@3.x.x
enable parsing the spread operator
use of the spread operator breaks coverage
Fix coverage when require cache is reset
--coverage-exclude should support multiple paths
Coverage calculated wrong.
Lab .eslintrc rules overrides local eslint rules.
Fix eslint configuration file format support.
fix diff text visibility for console reporter
Diff colors render diff text unreadable
8.0.0 release notes
Update dependencies
update to eslint-config-hapi@8.x.x
Add objectLiteralShorthandMethods to supported ES6 features
Update dependencies items and eslint
Coverage reporting does not support parsing ES6 objectLiteralComputedProperties
Es6-ify the README examples
Update hapijs/items to 2.0.0 from 1.1.1
Update linter to include for loop rules
Update hapi linter dependencies
Update to use ES6 style and lint rules
ES6 linting rules
consider testing arg passed to done is an error object
7.0.0 release notes
Remove node 0.10 support
Do not add tracking code before "var" in "for(var x of xs)"
for(var x of xs) is not handled correctly when coverage is turned on
Add objectLiteralShorthandMethods to supported ES6 features
Error data
6.0.0 release notes
Update to eslint-config-hapi@3.x.x
Lint warning for unused variables except internals
-V/--version flag to show version
Add --version to CLI
Rename template for npm publish
Add linting information and test failures to html
Upgrade deps and avoid relying on unix commands
Document html coverage report source markup
JSON reporter now supports lint output
add lint results to json reporter
Update insecure dependencies (eslint, handlebars)
Document coverage ignore syntax, fixes #438
Drop camelcase lint rule
Update to eslint-config-hapi@2.x.x
Add Infinity to stringify
Updated eslint version
Add docs for extending lab's linter
Use a shareable config for ESLint
.eslintrc files should build on default settings
Show invisible tokens on stringify
Fix stack traces when using transforms
Fix circular JSON for console reporter
Add command line options to override coverage path and excludes
Allow custom reporters from CLI
Custom reporters not allowed from cli
Fix test for equal call with extra param
Fix extra params passed to equal that are invalid
Update eslint to 1.0.x
Fix exit code when multiple reporters encounter a failure
enable more es6 features for Espree
Attach sub-reporters to the multiple reporter
Exit code always 0 with multiple reporters
Support filename pattern matching in CLI
File name matching glob pattern
Revert lint rule on spaced comments
Attach results to the reporter
Multiple reporters and multiple outputs
Update to eslint 0.24.x and add array bracket spacing linting rule
enable code coverage support with ES6
Added space after comment rule
Support more relaxed no-shadow rule
Update source-map-support to 0.3.x
Shadow lint error going too far
Remove lint rule for line around comments
Lint too aggressive with empty lines before comments
Use no-shadow lint rule
Enforce capitalization of imported module variable names
Linting update
Update license attribute
Cleanup repo style
Default both linting thresholds to 0.
Lint option -L should fail test if any linting problems are found
Use global handle for __$$labCov for use strict.
Change afterEaches to run in more natural order
unable to test when employing template strings
afterEach's run in unnatural order
Fix coverage on loop labels. Fixes #355.
Error when running lab with coverage on babel compiled code
Fix coverage modifying "use strict" statements.
Fix #351. Add message about threshold and npm error message.
npm ERR! Exit status 1 when threshold is not met
Lint thresholds
Add 4 space indent rule
Add some more rules to ESLint
Added two eslint rules to lab to enforce the hapi code style.
Switch to espree
Update dependencies
using `espree` or `acorn` instead of esprima
Fix HTML reporter when using live-transformed code
Add ESLint rule for blank line at beginning of function scope
[DEP] eslint 0.14 to 0.17
Update eslint to 0.17.0
Allow test files to have different extensions with transform
Fix EventEmitter bug
Fix domain not exited
Support custom reporters - closes #216 & closes #309
Allow --lint-options to be passed to configure linters
Fixes #319: Instructs --output to create given directory recursively.
--output should create given directory tree
add debug option to show domain error stack
Properly support sourcemaps when using the transform option
Add live transform of source code before coverage analysis
Remove Makefile and advice about it. Closes #284.
Linting update
Add Intl global
Ignore Intl global
Ignoring files in linting
make linter pluggable
Avoid double timeout on before/after
Fix before/after exceptions to be reported
Errors thrown in after & afterEach can cause immediate exit with code 0
(true ? true : false) ? 'x' : false === true when coverage enabled (should be 'x')
Add Map, Set, and WeakSet to the Harmony globals and improve testing
Fix console reporting
Remove extra hoek typo in package.json
Add verbosity index
5.0.0 Release Notes
Remove extra line breaks in lint report
Assertions library option
Fix documentation to exclude chai
Remove Chai
Lint report formatting
Remove chai
Fix #217: throw on invalid function declaration
Run linting in child process
Remove extra line breaks in report
Spawn linting in child process
Remove extra line breaks
Remove brace-style rule
Remove brace-style lint rule
Lint arg is now a boolean
Removing consistent-return
Drop consistent-return lint rule
Remove no-lonely-if
Switch -L to be boolean and only use eslint
Remove no-lonely-if
Ignore tests for lab
Add eslintignore for labs tests
Fixing lint rules and only showing files when issues
Only show linted files if there are issues
WIP - Add linting support
Support windows console output
Console reporter doesn't display well on windows
Fix mistakes on previous pull requests
Add optional timeouts on before(Each), after(Each)
Fix #178: Add sourcemaps support
Code coverage with sourcemaps support
Fix #209: omit undefined options
code error results in all tests passing
Support multiple tests from the command line.
Output and leaks are honored
CLI: -o not honored
Support junit as reporter on cli
junit reporter unavailable
Add --ignore option and document alias arguments
Add test for unknown arguments
Restrict CLI reporter checks and add usage on errors
Upping to bossy 1.0.0
Switching from optimist to bossy
Switch from optimist to bossy
Added clover reporter
Adding lcov format reporter
Stray asterisk in README
Add tests for coverage that throws
Option to output coverage in lcov format
Adding test run data to html report
Cleanup tests for timeout overrides
Add lines covered and not covered to the CC report
Way to get coverage report in HTML at the same time as console
4.1.0 Release Notes
updated README to cover JUnit reporter
Document JUnit reporter
Added junit reporter
Junit output
Feature - Prevent clobbered timer globals from interfering with runner
Updating TAP reporter to specification version 13
cli override. Closes #161
Allow setting CLI options programatically
Detect missing exports.lab in the cli runner
Handle tests without a "exports.lab" gracefully
Duration of tests shown via TAP
Clarify how `only` behaves
Skipped tests still reported on console reporter as being run
Set env variable immediately in cli
Environment not set before require when using CLI
Default to test environment
Changed session errors to script errors.
Environment set too late
Replace async with items
Reword session errors to test script errors
Replace use of async with items
Fixing issue with missing labCov reference
lab throws with ReferenceError: __$$labCov is not defined when run with coverage enabled and no code to cover
Add test for while coverage
Default to null for colors on cli for using tty capabilities
CLI colors aren't defaulted to tty capabilities
Moving to authors file and adding my name
Notebook updates
Fix for paths with hyphens and increase timeout
Cli tests
Update readme to reflect all the latest cli options
Add lib/cli.js to coverage tests
Expose notebook.errors in console reporter
Refactor to test lab with lab
Checking leaks on non-enumerable properties
4.0 Breaking Change
Add new ES6 types to knownGlobals
"Infinite" Timeout
Add describe.skip/only and it.skip/only
Repeat failure count at end of errors listing.
Lab.test.only and Lab.test.skip
Adding coverage tests skew the line-numbers in stack statements.
Lab doesn't show the assertion message when an assertion fails
Display Test duration once completed (even with errors)
tests should fail if before etc call back with an error or crash
Fix #99: ignore custom globals in leak detection
Add total missing lines to the coverage reporter
Add tests
Rename spumko to hapijs
simplify package.json example
Add chai optional message to output
Allow ability to execute specific subset of tests
Prints execution time for each test on console
Coverage file filter function modified to support Windows paths #32
Coverage not working on Windows
updated double call check on done to provide error to internals.output
Ability to skip coverage for a code section
Add command like option to force color output
Support passing 'done' as async callback
Show error message not just for boom
Expose Chai's assert flavour. Closes #75.
breaking changes
Skip test or experiment
Allow setting per test of experiment timeout
Allow setting parallel execution
Combine spec+console+summary with -s/-v flags
before/beforeEach/afterEach/after not run in correct order when using nested experiments
Rename -g to -l and make it disable detection
Remove coverage reporter
Remove verbose mode
Tap reporter
spec style formatting
fixed failure count so that non-zero exit code is return on test failure
Support verbose mode for console
Adding spec reporter
Remove SwitchCase from statement coverage
breaking changes
Move coverage functionality internally
update chai dependency, fix deprecation warning in chai
Allow specifying tests by id
Support beforeEach() (and afterEach())
Fixed branch checking
update readme
Fix double domain implicit enter()
fix for readme
add beforeEach() and afterEach()