[Pkg-javascript-commits] [node-tap] 27/186: unit test for extra-from-error

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 16:40:40 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 3ca79450afee57e5475307cede9bae5b6b4a37bd
Author: isaacs <i at izs.me>
Date:   Tue Sep 5 22:04:09 2017 -0700

    unit test for extra-from-error
---
 unit/extra-from-error.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/unit/extra-from-error.js b/unit/extra-from-error.js
new file mode 100644
index 0000000..74252c2
--- /dev/null
+++ b/unit/extra-from-error.js
@@ -0,0 +1,47 @@
+'use strict'
+const t = require('/usr/local/lib/node_modules/tap') // require('../')
+const extraFromError = require('../lib/extra-from-error.js')
+
+const cases = [
+  [new Error('ok'), null, null, {
+    at: { file: 'unit/extra-from-error.js' },
+    message: null
+  }],
+
+  [new Error('ok'), { foo: 'bar' }, null, {
+    at: { file: 'unit/extra-from-error.js' },
+    foo: 'bar'
+  }],
+
+  [new Error('ok'), null, { foo: 'bar', tapChild: 1234 }, {
+    at: { file: 'unit/extra-from-error.js' },
+    foo: 'bar',
+    tapChild: null
+  }],
+
+  [new Error('ok'), { foo: 'bar' }, { foo: 'XXX', tapChild: 1234 }, {
+    at: { file: 'unit/extra-from-error.js' },
+    foo: 'bar',
+    tapChild: null
+  }],
+
+  ['not an error', null, null, { error: 'not an error' }],
+
+  [new Error(''), null, null, {
+    at: { file: 'unit/extra-from-error.js' },
+    message: null
+  }],
+
+  [{stack: null, foo: 'baz', message: 'this is fine'}, null, null, {
+    stack: null,
+    foo: 'baz',
+    message: null
+  }],
+
+  [{ name: 'asdf' }, null, null, {
+    type: 'asdf',
+    message: null
+  }]
+]
+
+cases.forEach(c => t.match(extraFromError(c[0], c[1], c[2]), c[3]))

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