summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 19:34:31 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 19:34:31 +0100
commitb5fef15290ef976620315eacd4cb762d07e1e7c3 (patch)
tree41b17437a111943ea2f8afa3fbd585bb2f93261f
parent0b56dfce42c3944cce47e284608e6806f4c839c3 (diff)
Support tests using exports UI
-rw-r--r--package.json2
-rw-r--r--test/mocha.opts1
-rw-r--r--test/test.js11
3 files changed, 13 insertions, 1 deletions
diff --git a/package.json b/package.json
index a7a7a28..7ca400e 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
},
"scripts": {
"pretest": "eslint lib tests",
- "test": "mocha test --recursive",
+ "test": "mocha 'test/**/*.tests.js'",
"prepublish": "make mammoth.browser.min.js"
},
"license": "BSD-2-Clause"
diff --git a/test/mocha.opts b/test/mocha.opts
new file mode 100644
index 0000000..e3ca00a
--- /dev/null
+++ b/test/mocha.opts
@@ -0,0 +1 @@
+--ui exports
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..e48e57d
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,11 @@
+var path = require("path");
+
+
+var root = path.dirname(__dirname);
+
+module.exports = function(testModule) {
+ var tests = testModule.exports[path.relative(root, testModule.filename)] = {};
+ return function(name, func) {
+ tests[name] = func;
+ };
+};