[Pkg-javascript-commits] [node-tap] 70/186: Excluding snapshots means un-excluding everything else

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 16:40:45 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 505458f1d6e67032e611ed47c2282cb8a62ed0fb
Author: isaacs <i at izs.me>
Date:   Wed Nov 8 11:04:34 2017 +0000

    Excluding snapshots means un-excluding everything else
    
    See https://github.com/istanbuljs/nyc/issues/709
    
    Work around this by naming snapshots *.test.js rather than *.js
---
 bin/run.js                                         |  1 -
 lib/snapshot.js                                    |  3 +-
 ...nit-test.js-TAP.js => unit-test.js-TAP.test.js} | 57 ++++++++++++++++++++++
 3 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/bin/run.js b/bin/run.js
index 6d87a3c..a3c3542 100755
--- a/bin/run.js
+++ b/bin/run.js
@@ -423,7 +423,6 @@ const respawnWithCoverage = options => {
   const args = [nycBin].concat(
     '--silent',
     '--cache=true',
-    '--exclude=**/tap-snapshots/*.js',
     options.nycArgs,
     '--',
     process.execArgv,
diff --git a/lib/snapshot.js b/lib/snapshot.js
index 1a14ce2..874876f 100644
--- a/lib/snapshot.js
+++ b/lib/snapshot.js
@@ -10,11 +10,12 @@ class Snapshot {
   constructor (test) {
     this.indexes = new Map()
     this.test = test
+    // name them .test.js so that nyc ignores them
     this.file = path.resolve(
       process.cwd(),
       'tap-snapshots',
       this.test.fullname.replace(/[^a-zA-Z0-9\._\-]+/g, '-')
-    ) + '.js'
+    ) + '.test.js'
     this.snapshot = null
   }
 
diff --git a/tap-snapshots/unit-test.js-TAP.js b/tap-snapshots/unit-test.js-TAP.test.js
similarity index 96%
rename from tap-snapshots/unit-test.js-TAP.js
rename to tap-snapshots/unit-test.js-TAP.test.js
index 569d76c..e449a79 100644
--- a/tap-snapshots/unit-test.js-TAP.js
+++ b/tap-snapshots/unit-test.js-TAP.test.js
@@ -1982,6 +1982,63 @@ ok 2 - this should also end # {time}
 
 `
 
+exports[` TAP assertions and weird stuff endAll > endAll 1`] = `
+TAP version 13
+# Subtest: tests that have an endall method
+    # Subtest: this is the test that never ends
+        # Subtest: it goes on and on my friend
+            ok 1 - this is ok
+            # Subtest: misbehaving child
+                not ok 1 - test unfinished
+                  ---
+                  stack: |
+                    {STACK}
+                  test: misbehaving child
+                  at:
+                    line: #
+                    column: #
+                    file: unit/test.js
+                    function: Test.tt.test.tt
+                  source: |
+                    tt.test('misbehaving child', () => new Promise(()=>{}))
+                  ...
+                
+                1..1
+                # failed 1 test
+            not ok 2 - misbehaving child # {time}
+            
+            1..2
+            # failed 1 of 2 tests
+        not ok 1 - it goes on and on my friend # {time}
+        
+        ok 2 - some queue stuff
+        1..2
+        # failed 1 of 2 tests
+    not ok 1 - this is the test that never ends # {time}
+    
+    1..1
+    # failed 1 test
+not ok 1 - tests that have an endall method # {time}
+
+# Subtest: endAll on a stdin
+    # Subtest: /dev/stdin
+        ok - but not ended
+        
+        not ok 2 - test unfinished
+        
+        1..2
+        # failed 1 of 2 tests
+    not ok 1 - /dev/stdin # {time}
+    
+    1..1
+    # failed 1 test
+not ok 2 - endAll on a stdin # {time}
+
+1..2
+# failed 2 of 2 tests
+
+`
+
 exports[` TAP addAssert > using the custom isUrl assertion 1`] = `
 TAP version 13
 not ok 1 - expect a valid http/https url

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