buster-autotest
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -6,2 +6,3 @@ var wt = require("fs-watch-tree"); | ||
var path = require("path"); | ||
var oi = require("./on-interrupt"); | ||
@@ -28,12 +29,16 @@ function throttle(ms, callback, thisp) { | ||
var clearScreen = "\x1b[1;1H\x1b[2J"; | ||
function printHeader() { | ||
var now = new Date(); | ||
util.puts("\n"); | ||
util.puts(now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + " Running tests"); | ||
util.puts("``````````````````````"); | ||
var time = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(); | ||
util.puts(clearScreen + time + " Running tests"); | ||
} | ||
function success(code) { | ||
return code === 0; | ||
} | ||
exports.watch = function (dir, options) { | ||
var running = false; | ||
var failed = false; | ||
options = options || {}; | ||
@@ -63,3 +68,3 @@ | ||
function runTests(event) { | ||
if (running) return; | ||
if (running) { return; } | ||
running = true; | ||
@@ -84,7 +89,4 @@ findFiles(event, function (files) { | ||
test.on("exit", function (code) { | ||
var currentFailed = !!code; | ||
running = false; | ||
var runAll = failed && !currentFailed; | ||
failed = currentFailed; | ||
if (runAll) { runTests(); } | ||
if (success(code) && files.length > 0) { runTests(); } | ||
}); | ||
@@ -100,2 +102,4 @@ }); | ||
}); | ||
oi.onInterrupt("Running all tests.", run); | ||
}; |
{ | ||
"name": "buster-autotest", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Watch files and run buster tests on save", | ||
@@ -21,6 +21,12 @@ "homepage": "http://busterjs.org/docs/autotest", | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/buster/bin/buster-test" | ||
}, | ||
"dependencies": { | ||
"fs-watch-tree": ">=0.1", | ||
"buster-glob": ">=0.3.1" | ||
"fs-watch-tree": ">=0.2.1", | ||
"buster-glob": ">=0.3.2" | ||
}, | ||
"devDependencies": { | ||
"buster": "*" | ||
} | ||
} |
@@ -8,5 +8,7 @@ var buster = require("buster"); | ||
var glob = require("buster-glob"); | ||
var oi = require("../lib/on-interrupt"); | ||
buster.testCase("Autotest", { | ||
setUp: function () { | ||
this.stub(oi, "onInterrupt"); | ||
var self = this; | ||
@@ -196,3 +198,3 @@ this.stdout = ""; | ||
"does not run all tests when passing after passing": function () { | ||
"does not run all tests when failing after passing": function () { | ||
autotest.watch("/some/dir"); | ||
@@ -204,3 +206,3 @@ this.emitChange("test/thing-test.js"); | ||
this.clock.tick(10); | ||
this.passTests(); | ||
this.failTests(); | ||
@@ -210,3 +212,3 @@ assert.calledTwice(cp.spawn); | ||
"does not run all tests when failing after passing": function () { | ||
"does not re-run all tests after all passing": function () { | ||
autotest.watch("/some/dir"); | ||
@@ -216,5 +218,3 @@ this.emitChange("test/thing-test.js"); | ||
this.passTests(); | ||
this.emitChange("test/thing-test.js"); | ||
this.clock.tick(10); | ||
this.failTests(); | ||
this.clock.tick(20); | ||
@@ -221,0 +221,0 @@ assert.calledTwice(cp.spawn); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
12547
8
301
1
6
1
Updatedbuster-glob@>=0.3.2
Updatedfs-watch-tree@>=0.2.1