fix(ospec): Only run o.run() once (#2142)
This commit is contained in:
parent
cfaa377c1e
commit
ceabe993a3
1 changed files with 7 additions and 1 deletions
|
|
@ -27,11 +27,17 @@ const globList = args.globs && args.globs.length ? args.globs : ["**/tests/**/*.
|
|||
const ignore = ["**/node_modules/**"].concat(args.ignore||[])
|
||||
const cwd = process.cwd()
|
||||
|
||||
let pending = globList.length
|
||||
globList.forEach((globPattern) => {
|
||||
glob(globPattern, {ignore})
|
||||
.on("match", (fileName) => { require(path.join(cwd, fileName)) }) // eslint-disable-line global-require
|
||||
.on("error", (e) => console.error(e))
|
||||
.on("end", o.run)
|
||||
.on("end", () => {
|
||||
pending--
|
||||
if (pending === 0) {
|
||||
o.run()
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
process.on("unhandledRejection", (e) => { console.log("Uncaught (in promise) " + e.stack) })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue