[Pkg-javascript-commits] [node-tap] 69/186: Test for autoend

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 16:40:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap.

commit d0d39d9780a7a1268f8cbdb3c988fc99ab3d688d
Author: isaacs <i at izs.me>
Date:   Wed Nov 8 09:28:59 2017 +0000

    Test for autoend
---
 tap-snapshots/unit-test.js-TAP.js | 18 ++++++++++++++++++
 unit/test.js                      | 14 +++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tap-snapshots/unit-test.js-TAP.js b/tap-snapshots/unit-test.js-TAP.js
index 15ede14..569d76c 100644
--- a/tap-snapshots/unit-test.js-TAP.js
+++ b/tap-snapshots/unit-test.js-TAP.js
@@ -1964,6 +1964,24 @@ ok 1 - parent # {time}
 
 `
 
+exports[` TAP assertions and weird stuff autoEnd > autoEnd 1`] = `
+TAP version 13
+# Subtest: this should automatically end
+    ok 1 - this is fine
+    ok 2 - also fine
+    1..2
+ok 1 - this should automatically end # {time}
+
+# Subtest: this should also end
+    ok 1 - this is fine
+    ok 2 - also fine
+    1..2
+ok 2 - this should also end # {time}
+
+1..2
+
+`
+
 exports[` TAP addAssert > using the custom isUrl assertion 1`] = `
 TAP version 13
 not ok 1 - expect a valid http/https url
diff --git a/unit/test.js b/unit/test.js
index 5bd6a63..22c0cca 100644
--- a/unit/test.js
+++ b/unit/test.js
@@ -596,6 +596,19 @@ t.test('assertions and weird stuff', t => {
       })
       tt.end()
     },
+
+    autoEnd: tt => {
+      tt.options.autoend = true
+      tt.test('this should automatically end', { autoend: true }, t => {
+        t.pass('this is fine')
+        setTimeout(() => t.pass('also fine'))
+      })
+      tt.test('this should also end', t => {
+        t.pass('this is fine')
+        setTimeout(() => t.pass('also fine'))
+        t.autoend()
+      })
+    },
   }
 
   const keys = Object.keys(cases)
@@ -656,7 +669,6 @@ t.test('addAssert', t => {
   return t.end()
 })
 
-t.test('autoEnd')
 t.test('endAll')
 t.test('snapshots')
 t.test('spawn')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap.git



More information about the Pkg-javascript-commits mailing list