Collect test stats separately for each mode.

This commit is contained in:
Ingvar Stepanyan
2014-10-26 20:23:45 +02:00
committed by Marijn Haverbeke
parent b7367a2a8c
commit 0abe4b64a8
2 changed files with 43 additions and 18 deletions

View File

@@ -11,9 +11,8 @@
tests.push({code: code, assert: assert, options: options});
};
exports.runTests = function(config) {
var parse = config.parse, callback = config.callback;
var comments;
exports.runTests = function(config, callback) {
var parse = config.parse, comments;
function onComment(block, text, start, end, startLoc, endLoc) {
comments.push({
@@ -32,9 +31,11 @@
var test = tests[i];
try {
comments = [];
var testOpts = JSON.parse(JSON.stringify(test.options || opts));
if (!testOpts.onComment) testOpts.onComment = onComment;
var testOpts = test.options || opts;
var oldOnComment = testOpts.onComment;
if (!oldOnComment) testOpts.onComment = onComment;
var ast = parse(test.code, testOpts);
testOpts.onComment = oldOnComment;
if (test.error) {
if (config.loose) {
callback("ok", test.code);