15.0.0 • Published 5 months ago

nightingale-unit-testing v15.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Install

npm install --save-dev nightingale-unit-testing

Display a library logs

In your source file, use nightingale-logger.

In test-setup for example:

import 'nightingale-unit-testing';

By default, only log above 'ERROR' are displayed

When running test, use DEBUG to show all logs.

Example with jest:

DEBUG='my-lib' npm test

You can also use NIGHTINGALE_LIB_MIN_LEVEL to change the default level of log (but applies to every libraries). See nightingale-levels to know what values can be used.

# display all logs above 'INFO'
NIGHTINGALE_LIB_MIN_LEVEL=200 npm test

You can of course also combine the two

# display all logs above 'INFO', unless it's `my-lib` for which all logs are displayed
NIGHTINGALE_LIB_MIN_LEVEL=200 DEBUG='my-lib' npm test

Logging in tests

import { testLogger } from 'nightingale-unit-testing';

it('should test something', () => {
  const value = 'hello world';
  testLogger.inspectValue(value);
  expect(value).toBe('hello world');
});

By default, only log above 'DEBUG' are displayed in DEV and above 'INFO' in PRODUCTION (process.env.NODE_ENV === 'production')

15.0.0

5 months ago

14.2.0

6 months ago

14.2.1

6 months ago

14.0.0

11 months ago

14.1.0

10 months ago

14.0.1

11 months ago

14.0.2

11 months ago

13.0.0

1 year ago

12.1.4

2 years ago

12.1.3

2 years ago

12.1.2

2 years ago

12.1.1

2 years ago

12.1.0

2 years ago