watcher: Fix all tests

master
Jonatan Nilsson 2023-09-03 00:12:49 +00:00
parent fe2f6ccca9
commit b476d23a77
3 changed files with 699 additions and 710 deletions

View File

@ -4,7 +4,7 @@
"description": "Eltro is a tiny no-dependancy test framework for node", "description": "Eltro is a tiny no-dependancy test framework for node",
"main": "index.mjs", "main": "index.mjs",
"scripts": { "scripts": {
"test": "node cli.mjs 'test/**/*.test.mjs'", "test": "node cli.mjs \"test/**/*.test.mjs\"",
"test:watch": "npm-watch test" "test:watch": "npm-watch test"
}, },
"watch": { "watch": {

File diff suppressed because it is too large Load Diff

View File

@ -187,6 +187,12 @@ Builder.prototype.getAllDirectories = function() {
return walk(this.root) return walk(this.root)
} }
Builder.prototype.delay = function(delay) {
return new Promise(res => {
setTimeout(res, delay)
})
}
export function Counter(res, countTotal, waitForSignal = false) { export function Counter(res, countTotal, waitForSignal = false) {
this._res = res this._res = res
this.counter = 0 this.counter = 0
@ -208,6 +214,10 @@ Counter.prototype.waitForCount = function(promise) {
}) })
} }
Counter.prototype.updateRes = function(res) {
this._res = res
}
Counter.prototype.hasSignal = function() { Counter.prototype.hasSignal = function() {
if (this._gotSignal && this._signal) { if (this._gotSignal && this._signal) {
this._gotSignal = false this._gotSignal = false