-
Notifications
You must be signed in to change notification settings - Fork 959
Open
Labels
Description
One of the issues I've been having as I'm trying to fix things is that the custom test runner is a bit difficult to work with when trying to focus on a specific issue. After several cycles of commenting out every test except the one I'm working on, I hacked in testOnly
, testFailOnly
and testAssertOnly
locally and found that it really helped. Basically, the first one of these wins and all other tests are ignored. Here's the diff:
diff --git a/test/driver.js b/test/driver.js
index ed48ace..a582b93 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -1,16 +1,32 @@
(function(exports) {
- var tests = [];
+ var tests = [], only = false;
exports.test = function(code, ast, options) {
+ if (only) return;
tests.push({code: code, ast: ast, options: options});
};
exports.testFail = function(code, message, options) {
+ if (only) return;
tests.push({code: code, error: message, options: options});
};
exports.testAssert = function(code, assert, options) {
+ if (only) return;
tests.push({code: code, assert: assert, options: options});
};
+ exports.testOnly = function(code, ast, options) {
+ tests = [{code: code, ast: ast, options: options}];
+ only = true;
+ };
+ exports.testFailOnly = function(code, message, options) {
+ tests = [{code: code, error: message, options: options}];
+ only = true;
+ };
+ exports.testAssertOnly = function(code, assert, options) {
+ tests = [{code: code, assert: assert, options: options}];
+ only = true;
+ };
+
exports.runTests = function(config, callback) {
var parse = config.parse;
Would you be open to including this in Acorn?