[Pkg-javascript-commits] [node-tap] 68/186: grep tests

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 d3c8d6fabe1b104f66b9b813544ed137369b827b
Author: isaacs <i at izs.me>
Date:   Tue Nov 7 20:39:24 2017 +0000

    grep tests
---
 tap-snapshots/unit-test.js-TAP.js | 150 ++++++++++++++++++++++----------------
 unit/test.js                      |  44 ++++++++++-
 2 files changed, 131 insertions(+), 63 deletions(-)

diff --git a/tap-snapshots/unit-test.js-TAP.js b/tap-snapshots/unit-test.js-TAP.js
index 4fb0a25..15ede14 100644
--- a/tap-snapshots/unit-test.js-TAP.js
+++ b/tap-snapshots/unit-test.js-TAP.js
@@ -662,90 +662,46 @@ ok 3 - promisey # SKIP filter: only
 exports[`unit/test.js TAP short output checks parallel sub no options > parallel sub 1`] = `
 TAP version 13
 1..2
-# Subtest: slow child
+ok 1 - slow child # {time} {
     1..0
-ok 1 - slow child # {time}
+}
 
-# Subtest: fast child
-    not ok 1 - slow is going
-      ---
-      at:
-        line: #
-        column: #
-        file: unit/test.js
-        type: Timeout
-        function: _
-        method: _onTimeout
-      stack: |
-        {STACK}
-      source: |
-        tt.ok(slowGoing, 'slow is going')
-      ...
-    
+ok 2 - fast child # {time} {
+    ok 1 - slow is going
     1..1
-    # failed 1 test
-not ok 2 - fast child # {time}
+}
 
-# failed 1 of 2 tests
 
 `
 
 exports[`unit/test.js TAP short output checks parallel sub buffered > parallel sub 1`] = `
 TAP version 13
 1..2
-# Subtest: slow child
+ok 1 - slow child # {time} {
     1..0
-ok 1 - slow child # {time}
+}
 
-# Subtest: fast child
-    not ok 1 - slow is going
-      ---
-      at:
-        line: #
-        column: #
-        file: unit/test.js
-        type: Timeout
-        function: _
-        method: _onTimeout
-      stack: |
-        {STACK}
-      source: |
-        tt.ok(slowGoing, 'slow is going')
-      ...
-    
+ok 2 - fast child # {time} {
+    ok 1 - slow is going
     1..1
-    # failed 1 test
-not ok 2 - fast child # {time}
+}
 
-# failed 1 of 2 tests
 
 `
 
 exports[`unit/test.js TAP short output checks parallel sub bailout > parallel sub 1`] = `
 TAP version 13
 1..2
-# Subtest: slow child
+ok 1 - slow child # {time} {
     1..0
-ok 1 - slow child # {time}
+}
+
+ok 2 - fast child # {time} {
+    ok 1 - slow is going
+    1..1
+}
+
 
-# Subtest: fast child
-    not ok 1 - slow is going
-      ---
-      at:
-        line: #
-        column: #
-        file: unit/test.js
-        type: Timeout
-        function: _
-        method: _onTimeout
-      stack: |
-        {STACK}
-      source: |
-        tt.ok(slowGoing, 'slow is going')
-      ...
-    
-    Bail out! # slow is going
-BAILOUT: "# slow is going"
 `
 
 exports[`unit/test.js TAP short output checks parallel sub runOnly > parallel sub 1`] = `
@@ -1938,6 +1894,76 @@ TAP version 13
 
 `
 
+exports[` TAP assertions and weird stuff grep > grep 1`] = `
+TAP version 13
+# Subtest: parent
+    ok 1 - do not run this # SKIP filter: /x$/
+    # Subtest: but do run this x
+        ok 1 - do not run this # SKIP filter: /y$/
+        # Subtest: but do run this y
+            # Subtest: grand kids
+                1..0
+            ok 1 - grand kids # {time}
+            
+            # Subtest: get all the
+                1..0
+            ok 2 - get all the # {time}
+            
+            # Subtest: goodies
+                ok 1 - this is good
+                1..1
+            ok 3 - goodies # {time}
+            
+            1..3
+        ok 2 - but do run this y # {time}
+        
+        1..2
+        # skip: 1
+    ok 2 - but do run this x # {time}
+    
+    1..2
+    # skip: 1
+ok 1 - parent # {time}
+
+1..1
+
+`
+
+exports[` TAP assertions and weird stuff grepInvert > grepInvert 1`] = `
+TAP version 13
+# Subtest: parent
+    ok 1 - do not run this x # SKIP filter out: /x$/
+    # Subtest: but do run this
+        ok 1 - do not run this y # SKIP filter out: /y$/
+        # Subtest: but do run this
+            # Subtest: grand kids
+                1..0
+            ok 1 - grand kids # {time}
+            
+            # Subtest: get all the
+                1..0
+            ok 2 - get all the # {time}
+            
+            # Subtest: goodies
+                ok 1 - this is good
+                1..1
+            ok 3 - goodies # {time}
+            
+            1..3
+        ok 2 - but do run this # {time}
+        
+        1..2
+        # skip: 1
+    ok 2 - but do run this # {time}
+    
+    1..2
+    # skip: 1
+ok 1 - parent # {time}
+
+1..1
+
+`
+
 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 81a278a..5bd6a63 100644
--- a/unit/test.js
+++ b/unit/test.js
@@ -22,7 +22,7 @@ const clean = out => out
 
 t.test('short output checks', t => {
   const env = process.env.TAP_BUFFER
-  process.env.TAP_BUFFER = '0'
+  delete process.env.TAP_BUFFER
   t.teardown(_ => process.env.TAP_BUFFER = env)
 
   const cases = {
@@ -554,6 +554,48 @@ t.test('assertions and weird stuff', t => {
       tt.end()
       tt.comment('this is fine')
     },
+
+    grep: tt => {
+      tt.test('parent', { grep: [ /x$/, /y$/ ] }, tt => {
+        tt.test('do not run this', tt => tt.threw('no'))
+        tt.test('but do run this x', tt => {
+          tt.test('do not run this', tt => tt.threw('stop'))
+          tt.test('but do run this y', tt => {
+            tt.test('grand kids', tt => tt.end())
+            tt.test('get all the', tt => tt.end())
+            tt.test('goodies', tt => {
+              tt.pass('this is good')
+              tt.end()
+            })
+            tt.end()
+          })
+          tt.end()
+        })
+        tt.end()
+      })
+      tt.end()
+    },
+
+    grepInvert: tt => {
+      tt.test('parent', { grepInvert: true, grep: [ /x$/, /y$/ ] }, tt => {
+        tt.test('do not run this x', tt => tt.threw('no'))
+        tt.test('but do run this', tt => {
+          tt.test('do not run this y', tt => tt.threw('stop'))
+          tt.test('but do run this', tt => {
+            tt.test('grand kids', tt => tt.end())
+            tt.test('get all the', tt => tt.end())
+            tt.test('goodies', tt => {
+              tt.pass('this is good')
+              tt.end()
+            })
+            tt.end()
+          })
+          tt.end()
+        })
+        tt.end()
+      })
+      tt.end()
+    },
   }
 
   const keys = Object.keys(cases)

-- 
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