@@ -34,12 +34,18 @@ slight modifications.
3434 the main package export.
35353 . The test ends automatically when ` process.on('exit') ` fires, so
3636 there is no need to call ` tap.end() ` explicitly.
37- 4 . Adding a ` tearDown ` function triggers ` autoend ` behavior.
37+ 4 . Adding a ` tearDown ` function triggers ` autoend ` behavior, unless
38+ ` autoend ` was explicitly set to ` false ` .
39+
3840 Otherwise, the ` end ` would potentially never arrive, if for example
3941 ` tearDown ` is used to close a server or cancel some long-running
4042 process, because ` process.on('exit') ` would never fire of its own
4143 accord.
4244
45+ If you disable ` autoend ` , and _ also_ use a ` teardown() ` function on
46+ the main tap instance, you need to either set a ` t.plan(n) ` or
47+ explicitly call ` t.end() ` at some point.
48+
4349## tap.Test
4450
4551The ` Test ` class is the main thing you'll be touching when you use
@@ -229,3 +235,13 @@ Generally, you never need to worry about this directly.
229235However, this method can also be called explicitly in cases where an
230236error would be handled by something else (for example, a default
231237[ Promise] ( /promises/ ) ` .catch(er) ` method.)
238+
239+ ### t.autoend(value)
240+
241+ If ` value ` is boolean ` false ` , then it will disable the ` autoend `
242+ behavior. If ` value ` is anything other than ` false ` , then it will
243+ cause the test to automatically end when nothing is pending.
244+
245+ Note that this is triggered by default on the root ` tap ` instance when
246+ a ` teardown() ` function is set, unless ` autoend ` was explicitly
247+ disabled.
0 commit comments