[Pkg-javascript-commits] [node-tap] 74/186: Get rid of '(unnamed test)' as a name

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 236f2d6de4c83edc1260cb57e6637832d45e8a67
Author: isaacs <i at izs.me>
Date:   Thu Nov 9 11:11:35 2017 -0800

    Get rid of '(unnamed test)' as a name
    
    You can tell it's unnamed if it doesn't have a name.
---
 lib/parse-test-args.js                             |  6 ++--
 lib/test.js                                        | 10 +++---
 tap-snapshots/unit-test.js-TAP.test.js             | 37 ++++++++++------------
 test/test/end-exception--bail--buffer.tap          |  4 +--
 test/test/end-exception--bail.tap                  |  6 ++--
 test/test/end-exception--buffer.tap                |  4 +--
 test/test/end-exception.tap                        |  6 ++--
 test/test/promise-plan--buffer.tap                 |  2 +-
 test/test/promise-plan.tap                         |  2 +-
 test/test/subtest-with-only-a-function--buffer.tap |  2 +-
 test/test/subtest-with-only-a-function.tap         |  4 +--
 .../subtest-with-options-and-function--buffer.tap  |  2 +-
 test/test/subtest-with-options-and-function.tap    |  4 +--
 test/test/unfinished--buffer.tap                   | 10 +++---
 test/test/unfinished.tap                           | 10 +++---
 15 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/lib/parse-test-args.js b/lib/parse-test-args.js
index 648afc7..feda74e 100644
--- a/lib/parse-test-args.js
+++ b/lib/parse-test-args.js
@@ -10,9 +10,9 @@ module.exports = (name_, extra_, cb_, defaultName) => {
 
   const args = [name_, extra_, cb_]
 
-  // this only works if it's literally the 4th argument.  it's mostly
+  // this only works if it's literally the 4th argument.
   // used internally.
-  defaultName = defaultName || '(unnamed test)'
+  defaultName = defaultName || ''
 
   for (let i = 0; i < 3 && i < args.length; i++) {
     const arg = args[i]
@@ -40,7 +40,7 @@ module.exports = (name_, extra_, cb_, defaultName) => {
   if (!extra)
     extra = {}
 
-  if (!cb)
+  if (!cb && defaultName !== '/dev/stdin')
     extra.todo = true
 
   if (!name && extra.name)
diff --git a/lib/test.js b/lib/test.js
index b66eebd..e99559e 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -200,8 +200,9 @@ class Test extends Base {
   }
 
   stdin (name, extra) {
-    extra = parseTestArgs(name, extra, () => {}, '/dev/stdin')
-    return this.sub(Stdin, extra || {}, Test.prototype.stdin)
+    /* istanbul ignore next */
+    extra = parseTestArgs(name, extra, false, '/dev/stdin')
+    return this.sub(Stdin, extra, Test.prototype.stdin)
   }
 
   bailout (message) {
@@ -1338,8 +1339,9 @@ const endAllQueue = queue => {
   queue.forEach((p, i) => {
     if ((p instanceof Base) && !p.readyToProcess)
       queue[i] = new TestPoint(false,
-        'child test left in queue ' + p.constructor.name + ': ' +
-        p.name, p.options)
+        'child test left in queue:' +
+        ' t.' + p.constructor.name.toLowerCase() + ' ' + p.name,
+        p.options)
   })
   queue.push(['end', IMPLICIT])
 }
diff --git a/tap-snapshots/unit-test.js-TAP.test.js b/tap-snapshots/unit-test.js-TAP.test.js
index c2d1244..5f68f90 100644
--- a/tap-snapshots/unit-test.js-TAP.test.js
+++ b/tap-snapshots/unit-test.js-TAP.test.js
@@ -796,7 +796,7 @@ ok 2 - fast child # SKIP filter: only
 
 exports[`unit/test.js TAP short output checks reasoned bailout no options > reasoned bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out! not fine
 BAILOUT: "not fine"
@@ -804,7 +804,7 @@ BAILOUT: "not fine"
 
 exports[`unit/test.js TAP short output checks reasoned bailout buffered > reasoned bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out! not fine
 BAILOUT: "not fine"
@@ -812,7 +812,7 @@ BAILOUT: "not fine"
 
 exports[`unit/test.js TAP short output checks reasoned bailout bailout > reasoned bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out! not fine
 BAILOUT: "not fine"
@@ -828,7 +828,7 @@ ok 1 - (unnamed test) # SKIP filter: only
 
 exports[`unit/test.js TAP short output checks unreasonable bailout no options > unreasonable bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out!
 
@@ -836,7 +836,7 @@ TAP version 13
 
 exports[`unit/test.js TAP short output checks unreasonable bailout buffered > unreasonable bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out!
 
@@ -844,7 +844,7 @@ TAP version 13
 
 exports[`unit/test.js TAP short output checks unreasonable bailout bailout > unreasonable bailout 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     Bail out!
 
@@ -860,7 +860,7 @@ ok 1 - (unnamed test) # SKIP filter: only
 
 exports[`unit/test.js TAP short output checks bailout after end no options > bailout after end 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     1..1
 Bail out! not fine
@@ -869,7 +869,7 @@ BAILOUT: "not fine"
 
 exports[`unit/test.js TAP short output checks bailout after end buffered > bailout after end 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     1..1
 Bail out! not fine
@@ -878,7 +878,7 @@ BAILOUT: "not fine"
 
 exports[`unit/test.js TAP short output checks bailout after end bailout > bailout after end 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     ok 1 - this is fine
     1..1
 Bail out! not fine
@@ -1143,11 +1143,11 @@ ok 1 - child test # SKIP filter: only
 
 exports[`unit/test.js TAP short output checks child end event thrower no options > child end event thrower 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..1
     ok 1 - should be equal
 # end() event
-ok 1 - (unnamed test) # {time}
+ok 1 # {time}
 
 not ok 2 - beep
   ---
@@ -1158,7 +1158,6 @@ not ok 2 - beep
     column: #
     file: unit/test.js
     function: Test.<anonymous>
-  test: (unnamed test)
   source: |
     throw new Error('beep')
   ...
@@ -1170,11 +1169,11 @@ not ok 2 - beep
 
 exports[`unit/test.js TAP short output checks child end event thrower buffered > child end event thrower 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..1
     ok 1 - should be equal
 # end() event
-ok 1 - (unnamed test) # {time}
+ok 1 # {time}
 
 not ok 2 - beep
   ---
@@ -1185,7 +1184,6 @@ not ok 2 - beep
     column: #
     file: unit/test.js
     function: Test.<anonymous>
-  test: (unnamed test)
   source: |
     throw new Error('beep')
   ...
@@ -1197,11 +1195,11 @@ not ok 2 - beep
 
 exports[`unit/test.js TAP short output checks child end event thrower bailout > child end event thrower 1`] = `
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..1
     ok 1 - should be equal
 # end() event
-ok 1 - (unnamed test) # {time}
+ok 1 # {time}
 
 not ok 2 - beep
   ---
@@ -1212,7 +1210,6 @@ not ok 2 - beep
     column: #
     file: unit/test.js
     function: Test.<anonymous>
-  test: (unnamed test)
   source: |
     throw new Error('beep')
   ...
@@ -1942,9 +1939,9 @@ Error: test after end() was called
 exports[`unit/test.js TAP assertions and weird stuff plan, child test, explicit end > plan, child test, explicit end 1`] = `
 TAP version 13
 1..1
-# Subtest: (unnamed test)
+# Subtest
     1..0
-ok 1 - (unnamed test) # {time}
+ok 1 # {time}
 
 
 `
diff --git a/test/test/end-exception--bail--buffer.tap b/test/test/end-exception--bail--buffer.tap
index d4e8a84..794ae3f 100644
--- a/test/test/end-exception--bail--buffer.tap
+++ b/test/test/end-exception--bail--buffer.tap
@@ -1,13 +1,13 @@
 TAP version 13
 end()
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~ {
+ok 1 ___/# time=[0-9.]+(ms)?/~~~ {
     1..1
     ok 1 - should be equal
 }
 
 not ok 2 - beep
   ---
-  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n","test":"(unnamed test)"}
+  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n"}
   ...
 
 Bail out! # beep
diff --git a/test/test/end-exception--bail.tap b/test/test/end-exception--bail.tap
index 4c71136..37b535a 100644
--- a/test/test/end-exception--bail.tap
+++ b/test/test/end-exception--bail.tap
@@ -1,13 +1,13 @@
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..1
     ok 1 - should be equal
 end()
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~
+ok 1 ___/# time=[0-9.]+(ms)?/~~~
 
 not ok 2 - beep
   ---
-  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n","test":"(unnamed test)"}
+  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n"}
   ...
 
 Bail out! # beep
diff --git a/test/test/end-exception--buffer.tap b/test/test/end-exception--buffer.tap
index f5c632d..35486e6 100644
--- a/test/test/end-exception--buffer.tap
+++ b/test/test/end-exception--buffer.tap
@@ -1,13 +1,13 @@
 TAP version 13
 end()
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~ {
+ok 1 ___/# time=[0-9.]+(ms)?/~~~ {
     1..1
     ok 1 - should be equal
 }
 
 not ok 2 - beep
   ---
-  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n","test":"(unnamed test)"}
+  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n"}
   ...
 
 1..2
diff --git a/test/test/end-exception.tap b/test/test/end-exception.tap
index 12a102f..a3d84a9 100644
--- a/test/test/end-exception.tap
+++ b/test/test/end-exception.tap
@@ -1,13 +1,13 @@
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..1
     ok 1 - should be equal
 end()
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~
+ok 1 ___/# time=[0-9.]+(ms)?/~~~
 
 not ok 2 - beep
   ---
-  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n","test":"(unnamed test)"}
+  {"at":{"column":11,"file":"test/test/end-exception.js","line":8},"source":"throw new Error('beep')\n"}
   ...
 
 1..2
diff --git a/test/test/promise-plan--buffer.tap b/test/test/promise-plan--buffer.tap
index 52950e1..6a3f090 100644
--- a/test/test/promise-plan--buffer.tap
+++ b/test/test/promise-plan--buffer.tap
@@ -41,7 +41,7 @@ not ok 5 - thrown with timeouts ___/# time=[0-9.]+(ms)?/~~~
   ...
 {
     1..2
-    not ok 1 - child test left in queue Test: plan
+    not ok 1 - child test left in queue: t.test plan
     not ok 2 - wtf
       ---
       {"at":{"column":15,"file":"test/test/promise-plan.js","line":63},"source":"throw new Error('wtf')\n","test":"end()"}
diff --git a/test/test/promise-plan.tap b/test/test/promise-plan.tap
index 03a8200..6a735ee 100644
--- a/test/test/promise-plan.tap
+++ b/test/test/promise-plan.tap
@@ -42,7 +42,7 @@ not ok 4 - broken promises ___/# time=[0-9.]+(ms)?/~~~
     1..2
     # Subtest: end()
         1..0
-    not ok 1 - child test left in queue Test: plan
+    not ok 1 - child test left in queue: t.test plan
     not ok 2 - wtf
       ---
       {"at":{"column":15,"file":"test/test/promise-plan.js","line":63},"source":"throw new Error('wtf')\n","test":"end()"}
diff --git a/test/test/subtest-with-only-a-function--buffer.tap b/test/test/subtest-with-only-a-function--buffer.tap
index 3c1bc2d..cf29975 100644
--- a/test/test/subtest-with-only-a-function--buffer.tap
+++ b/test/test/subtest-with-only-a-function--buffer.tap
@@ -1,5 +1,5 @@
 TAP version 13
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~ {
+ok 1 ___/# time=[0-9.]+(ms)?/~~~ {
     1..0
 }
 
diff --git a/test/test/subtest-with-only-a-function.tap b/test/test/subtest-with-only-a-function.tap
index e8fd44c..2bb67f5 100644
--- a/test/test/subtest-with-only-a-function.tap
+++ b/test/test/subtest-with-only-a-function.tap
@@ -1,7 +1,7 @@
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..0
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~
+ok 1 ___/# time=[0-9.]+(ms)?/~~~
 
 1..1
 
diff --git a/test/test/subtest-with-options-and-function--buffer.tap b/test/test/subtest-with-options-and-function--buffer.tap
index c2932c6..3d42596 100644
--- a/test/test/subtest-with-options-and-function--buffer.tap
+++ b/test/test/subtest-with-options-and-function--buffer.tap
@@ -1,5 +1,5 @@
 TAP version 13
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~
+ok 1 ___/# time=[0-9.]+(ms)?/~~~
   ---
   {"some":"diags"}
   ...
diff --git a/test/test/subtest-with-options-and-function.tap b/test/test/subtest-with-options-and-function.tap
index 797c32d..c040a6f 100644
--- a/test/test/subtest-with-options-and-function.tap
+++ b/test/test/subtest-with-options-and-function.tap
@@ -1,7 +1,7 @@
 TAP version 13
-# Subtest: (unnamed test)
+# Subtest
     1..0
-ok 1 - (unnamed test) ___/# time=[0-9.]+(ms)?/~~~
+ok 1 ___/# time=[0-9.]+(ms)?/~~~
   ---
   {"some":"diags"}
   ...
diff --git a/test/test/unfinished--buffer.tap b/test/test/unfinished--buffer.tap
index 02313c9..9e0af57 100644
--- a/test/test/unfinished--buffer.tap
+++ b/test/test/unfinished--buffer.tap
@@ -22,11 +22,11 @@ not ok 4 - failsome
   {"at":{"column":5,"file":"test/test/unfinished.js","line":23},"hoo":"hah","source":"tap.fail('failsome', { hoo: 'hah' })\n"}
   ...
 
-not ok 5 - child test left in queue Spawn: spawny
-not ok 6 - child test left in queue Spawn: ___/.*(node(js)?|iojs)(.exe)?/~~~ --version
-not ok 7 - child test left in queue Test: (unnamed test)
-not ok 8 - child test left in queue Test: (unnamed test)
-not ok 9 - child test left in queue Test: t2
+not ok 5 - child test left in queue: t.spawn spawny
+not ok 6 - child test left in queue: t.spawn ___/.*(node(js)?|iojs)(.exe)?/~~~ --version
+not ok 7 - child test left in queue: t.test
+not ok 8 - child test left in queue: t.test
+not ok 9 - child test left in queue: t.test t2
 1..4
 # test count(9) != plan(4)
 # failed 7 of 9 tests
diff --git a/test/test/unfinished.tap b/test/test/unfinished.tap
index 863e176..a9b6337 100644
--- a/test/test/unfinished.tap
+++ b/test/test/unfinished.tap
@@ -22,11 +22,11 @@ not ok 4 - failsome
   {"at":{"column":5,"file":"test/test/unfinished.js","line":23},"hoo":"hah","source":"tap.fail('failsome', { hoo: 'hah' })\n"}
   ...
 
-not ok 5 - child test left in queue Spawn: spawny
-not ok 6 - child test left in queue Spawn: ___/.*(node(js)?|iojs)(.exe)?/~~~ --version
-not ok 7 - child test left in queue Test: (unnamed test)
-not ok 8 - child test left in queue Test: (unnamed test)
-not ok 9 - child test left in queue Test: t2
+not ok 5 - child test left in queue: t.spawn spawny
+not ok 6 - child test left in queue: t.spawn ___/.*(node(js)?|iojs)(.exe)?/~~~ --version
+not ok 7 - child test left in queue: t.test
+not ok 8 - child test left in queue: t.test
+not ok 9 - child test left in queue: t.test t2
 1..4
 # test count(9) != plan(4)
 # failed 7 of 9 tests

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