All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.8.2 - 2022-03-17
- bug where
test.endAfterSubtests()
would cause an error if the test was finished beforeendAfterSubtests
got a chance to process its checks. - remove warnings from
yaml
library that are not actionable right now see issue.
0.8.1 - 2022-03-06
- extract contains/containsGreedy matchers to compare fns.
test#defer(fn, { ignoreErrors: false })
to execute some function right before the end of the test. It is useful for test clean up callbacks. If thefn
returns aPromise
it will be waited upon and delay the test finish.
- comparison of errors in
compare.strictEqual
/compare.equal
.
0.8.0 - 2021-01-14
metatests.measure()
function to perform microbenchmarks with multiple configuration options.compare.R
script to perform statistically significant benchmark result analysis.metatests.convertToCsv()
function to convertmetatests.measure()
results to valid CSV format.metatests speed
command to run simple speed tests on exported from file functions via cli.metatests measure
command to run comprehensive speed tests on exported from file functions via cli and comparing different implementations.- TypeScript typings for all APIs of
metatests
. - Support for .cjs and .mjs test file extensions.
- Comparison of
Map
andSet
objects. - Printing of Error/Date/RegExp object in TapReporter for JS
vm
sandboxes
- BREAKING: Dropped support for Node.js 10
0.7.2 - 2020-07-27
test#is(checkFn, val, message)
that allows passing custom comparator function to avoid usingtest#assert()
that will only displaytrue
/false
result.test#isArray()
test#isBuffer()
utilities fortest#is()
that just call it withArray.isArray
andBuffer.isBuffer
appropriately.test.regex(regex, input, message)
to simplify checking for regex pattern match. This avoids usingtest.assert()
and shows actual pattern/input in the test output.
- cli to replace forward slash (
/
) in--exclude
option with OS specific path separator.
CHANGELOG.md
Changed/Fixed title level in0.7.1
version.null
/undefined
as uncaughtException are properly handled.
- Update project dependencies and fix security issues.
0.7.1 - 2019-07-05
- This CHANGELOG.md file.
test.containsGreedy()
that works similar totest.contains()
but will greedily search for at least one successful comparison for each element.
test.contains()
to support more types. It can now be used with Array, Set, Map and as it was with objects and also as combinations of those types (i.e. compare Set and Array, Map and Object).- Use original call stack in
test.mustCall()
/test.mustNotCall()
(call stack of caller). - Errors stringified by TapReporter won't have
!error
tag anymore which will result in them being displayed as simple objects in diff and avoid hiding necessary details.
- Duplicate test numbers in TapReporter 'Failed' output.
0.7.0 - 2019-05-15
- Handle
test.resolves(promise)
differently fromtest.resolves(promise, undefined)
. The former version will not check forstrictSame
of the promise result withundefined
but the latter will.
- Increase stack trace size when possible.
- Explicitly record 'rejects'/'resolves' in
test.resolves()
/test.rejects()
. - Change CLI waiting timeout behavior. If there are failures the process will now exit immediately, otherwise wait for normal process finish or exit with code 1 after timeout.
- Use promises in beforeEach/afterEach callback handling. This delays test execution and finish by 1 event loop tick respectively.
- Enforce test failure and notify of multiple
_end
calls. - Preserve stack of original error from 'erroer' when emitting.
- Call
subtest._end()
on subtests in a queue upon parentparent._end()
.
0.6.6 - 2019-05-11
equalTopology
to compare with circular references.test.sameTopology()
to usecompare.sameTopology()
.test.resolves()
,test.rejects()
utilities.- Support promises in
test.beforeEach()
/test.afterEach()
.
- Add error to the
test.fail()
signature. It can now be used astest.fail(msg)
,test.fail(err)
,test.fail(msg, err)
. - Call
test.end()
/test.endAfterSubtests()
on test promise resolve. - Harden argument alias check in
test.fail()
. - Use new
test.fail(msg, err)
interface in code. - Rename
equalWithCircular
tosameTopology
. - Use
tap-yaml
in cli and to properly stringify inTapReporter
. - Make subtest result in parent more robust by using
test.success
. - Move
test.context
initilization toTest
.
test.type()
on objects with no constructor.
0.6.5 - 2019-04-10
- Support for running test code in
worker_threads
.
- Move setting default
TapReporter
type to cli. - Output filename in case of error in
TapReporter
.
- Reporting of 'error' events on
Test
inTapReporter
.
0.6.4 - 2019-04-08
- Use
yargs
instead ofcommander
for cli. - Check for incorrect values of plan.
test.plan()
+test.mustCall()
interoperability.- Test time report of sync test.
- Properly report plan after timeout.
0.6.3 - 2019-04-01
- Sync
ImperativeTest
without function finish. TapReporter
with timeout result.
0.6.2 - 2019-03-29
logComment
toReporter
interface.- Test execution time reporting.
- Make
imperative.end-before-timeout
test more robust. - Use
TapReporter
type 'tap' on nonTTY and 'classic' on TTY streams.
metadata.filepath
test not calling 'end'.
0.6.1 - 2019-03-26
- Remove usage of
console
fromReporter
s.
0.6.0 - 2019-03-25
- Unit tests.
TapReporter
complying to TAP 13.- Custom exit timeout.
- 'log' inside test via 'test.log'.
- Support for
TAP
formatters.
- Allow to run
DeclarativeTest
fromImperativeTest
. - Align
ImperativeTest
constructor with the usage. - Use node
util.inspect()
if available for better test results output. - Improve
TapReporter
output. - Update project dependencies.
- Update
stryker
to the 1.0+. - Make
tap-classic
default reporter.
- Dropped CLI support for browsers.
- Dropped Node.js 6 support.
- Handle promise rejections from test function.
DeclarativeTest.constructor()
interface to comply with 'case'.
0.5.0 - 2019-02-14
- Remove 'err' argument from
test.cbFail()
callback. - Allow to pass
afterAll
callback totest.cbFail()
.
- Don't call subtest function if test ended in
test.beforeEach()
.
0.4.1 - 2019-02-12
test.contains()
to allow partial obj checks.test.cb()
/test.cbFail()
to avoid error handling boilerplate code. The former will perform thetest.error()
check on the first passed to the callback argument and forward them, the latter will in case of error performtest.fail()
,test.end()
and will NOT call the supplied callback, othrwise calls the callback with other arguments (besides the first).
- Add 'filename' to the
Test
metadata. - Report 'filename' in
ConciseReporter
if available. - Use prettier for code formatting.
- Don't run subtest
TODO
tests by default, respectrunTodo
inRunner
. - Filename resolution for renamed package directory.
0.4.0 - 2018-12-19
todo
option for cli.
- Allow to pass
Error
totest.bailout
.
- Crash on
unhandledException
independentSubtests
. - Flakiness of
unhandledExceptions
handling test. - Typo
unhandledExeption
->unhandledException
. - Properly check
Error
instance intest.error()
. - Properly extract
bailout
anddependentSubtests
tests. - Race condition in
unhandledException
test.
0.3.0 - 2018-11-21
test.bailout()
that will cease execution.Runner.wait()
/Runner.resume()
to postpone 'finish' report.
- Harden
testAsync
async enforcement test. - Make fail only report 'failed' not end test.
- Comparison in declarative tests.
0.2.4 - 2018-11-12
test.plan()
tests.test.mustCall()
/test.mustNotCall()
tests.- Setter for running 'todo' in Runner.
- Support for
dependentSubtests
option toImperativeTest
that will inform the test to stop running its subtests as soon as at least of them fails.
- Add default empty lambda as 'fn' in
test.mustCall()
/test.mustNotCall()
.
- Omit type of
undefined
values inreporter
. todo
test reporting.
0.2.3 - 2018-11-01
- Improve
reporter
output. - Move
eslint
related dependencies todevDependencies
.
0.2.2 - 2018-10-31
- Simple function comparison via
toString()
.
- Report only existing result properties.
- Replace obsolete
PhantomJS
withChromeHeadless
. - Use
eslint-config-metarhia
and fix linting issues. - Show config depending on its log level.
- Dropped support for Node.js 9.
- Remove actual/expected args from unrelated checks.
- Omit 'type' while reporting
undefined
andnull
. - Allow
Runner.reporter
to benull
. - Flaky 'nested test that ends after subtests'.
- Properly output
Error
instance. - Cli incorrect exit code reporting.
Error
stack missing important information.
0.2.1 - 2018-09-27
- Mark runner result as failed upon 'error' event.
- Return (sub)test instance on subtest creation.
- Tests to improve coverage.
- Enhance cli to support running tests in
Node.js
and browser.
- Move failure exit from
reporter
torunner
. - Improve
assert
failure reporting. - Use 'domain's to catch
unhandledExeptions
in tests. - Slightly simplify and refactor
compare.js
. - Update example in README.md.
- Move benchmarks from
./test
to separate folder. - Remove external variable declarations from loops.
- Remove unnecessary exit-code test.
- Add missed return in
testSync
,testAsync
aliases. - Remove flakiness of
setTimeout
from test. - Don't mark finished tests as failures in
Runner
. - Flaky
afterEach()
test. - Make timeouted tests emit 'done', not 'error'.
- Incorrect description in example test case.
0.2.0 - 2018-08-29
- New functionality.
- Report:
ConciseReporter
that just prints minimal needed info and is used by default.
- Runner:
- New runner class that currently only listens to the tests and progagates treir results to Reporter. Uses ConciseReporter by default.
- Method 'addTest' adds test to current runner to observe.
- Runner emits 'finish' event when all of the tests it observers have finished.
- Case:
case()
function that just createsDeclarativeTest
and uses default runner if not provided.
- Test:
isError()
to check if you have received an error (previously you'd have to usetest.ok(err instanceof Error)
or smth similar).fail()
to fail the test immediately with specified error message.test()
that adds a subtest to this test. This test will end until all subtests have finished (has 2 aliasestestSync()
andtestAsync()
).beforeEach
() method(test, callback)
- it will be run before each subtest and its result (must be object) passed to callback willbeforeEach()
passed to the subtest(test.test('caption', (subtest, context) => {}))
.afterEach()
method(test, callback)
- it will be run after each subtest and next (sequential) subtest will not be run until this method calls callback.endAfterSubtests()
method to automatically end this test after all of the subtests has finished.strictNotSame()
(same asstrictNotSame()
but for strict equality).- Allow to listen on test finish event
.on('done', (test) => {})
. - 'error' event for errors that happed after test has ended
(signature is
(test, error)
). Example errors: check after end, end after end, end on test-wit-plan etc. - Test timeout (
30s
default) that will fail the test if it hasn't finished within the timeout time.
- Report:
- Refactor typeof usage for metatests.
- Refactor whole tests to remove cyclic deps.
- get rid of cyclic dependencies between modules.
- Namespaces:
- Removed and replaced with per-case namespace.
- Report:
- Refactor
Reporter
class with general reporting functionality. report()
method no longer triggers any tests - it only reports overall result.record()
is called on eachTest
to parse/save the results of individual tests.finish()
is called by when this reporter has to finish reporting and possibly print some general info.error()
will be called when the error has occured after the test have finished.
- Refactor
- Case:
- Refactor without globals and implicit dependencies on other modules.
- Clean up code, avoid unnecessary checks.
- Rename to
DeclarativeTest
that implementsTest
for declarative tests and usesrunNow()
method to run what previously 'case' method did.
- Test:
- File renamed to
imperative-test.js
. - Refactor with es6 classes, clean up code and aliases.
- Now each test is separate and therefore any test-file can be run as a
separate program via just node (test will be by default run on
nextTick
if not disabled via 'run = false' option). - All results are recorded including successful (this will allow to provide rich error reporting later on and avoid unnecessary variables to keep track of).
notOk()
is now an alias ofassetNot()
(previously it was whatfail()
does now).test()
method subtests can be run in parallel, it is controlled by theparallelSubtests
(false
default) option on the parent test.- Test plan now properly checks and finishes the test.
- Tests can now have metadata.
- Tests now store results of all checks in 'results'.
- File renamed to
0.1.12 - 2018-08-07
- Queuing tests execution.
0.1.11 - 2018-06-27
- Use eslint for tests.
- Finish test automatically if
test.plan(n)
used.
- Remove
.bithoundrc
andbithound
badge inREADME.md
.
0.1.10 - 2018-06-26
- Display report sequential on done.
- Error thrown by comparing object with
null
.
0.1.9 - 2018-05-24
- Run test sequential by default.
- Change
[object Object]
representation to json.
0.1.8 - 2018-05-15
test.type()
andtest.error()
methods.
- Improve reporting.
0.1.7 2018-05-14
- Move
metarhia-common
tests to same-named repo. - Restructure modules.
- Unify reporting and shorten stack.
- Increment statistics and exit 1.
0.1.6 - 2018-05-12
- Tests for
equal()
. - Tests for
strictEqual()
.
equal()
function.strictEqual()
function.
0.1.5 - 2018-05-08
throws()
anddoesNotThrow()
methods.
0.1.4 - 2018-05-07
isArray
spelling.
0.1.3 - 2018-05-07
- Deep compare.
0.1.2 - 2018-05-05
- API for imperative tests.
- Render results output.
0.1.1 - 2018-05-02
- Tests for metarhia-common.
- Change badges.
- Update examples.
0.1.0 - 2018-04-29
- The first version of the
metatests
package.