watcher: Fix all tests

This commit is contained in:
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",
"main": "index.mjs",
"scripts": {
"test": "node cli.mjs 'test/**/*.test.mjs'",
"test": "node cli.mjs \"test/**/*.test.mjs\"",
"test:watch": "npm-watch test"
},
"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)
}
Builder.prototype.delay = function(delay) {
return new Promise(res => {
setTimeout(res, delay)
})
}
export function Counter(res, countTotal, waitForSignal = false) {
this._res = res
this.counter = 0
@ -208,6 +214,10 @@ Counter.prototype.waitForCount = function(promise) {
})
}
Counter.prototype.updateRes = function(res) {
this._res = res
}
Counter.prototype.hasSignal = function() {
if (this._gotSignal && this._signal) {
this._gotSignal = false