clarity-cli
Advanced tools
Comparing version 1.0.11 to 1.0.12
{ | ||
"name": "clarity-cli", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "Clarity setup for vscode.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -5,3 +5,11 @@ var fs = require("fs-extra"); | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
return Promise.resolve(null); | ||
} | ||
fs.readdir(testDirectory).then((files) => { | ||
@@ -14,3 +22,8 @@ files.forEach((file) => { | ||
Object.keys(defaultModules).reduce((promise, testName) => { | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
return specialTestNames[testName] == null; | ||
}).reduce((promise, testName) => { | ||
if (typeof defaultModules[testName] !== "function") { | ||
@@ -37,3 +50,5 @@ return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
}); | ||
}, Promise.resolve()).catch((error) => { | ||
}, prepare()).then(()=>{ | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
@@ -40,0 +55,0 @@ }); |
@@ -5,3 +5,11 @@ var fs = require("fs-extra"); | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
return Promise.resolve(null); | ||
} | ||
fs.readdir(testDirectory).then((files) => { | ||
@@ -14,3 +22,8 @@ files.forEach((file) => { | ||
Object.keys(defaultModules).reduce((promise, testName) => { | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
return specialTestNames[testName] == null; | ||
}).reduce((promise, testName) => { | ||
if (typeof defaultModules[testName] !== "function") { | ||
@@ -37,3 +50,5 @@ return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
}); | ||
}, Promise.resolve()).catch((error) => { | ||
}, prepare()).then(()=>{ | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
@@ -40,0 +55,0 @@ }); |
@@ -5,3 +5,11 @@ var fs = require("fs-extra"); | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
return Promise.resolve(null); | ||
} | ||
fs.readdir(testDirectory).then((files) => { | ||
@@ -14,3 +22,8 @@ files.forEach((file) => { | ||
Object.keys(defaultModules).reduce((promise, testName) => { | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
return specialTestNames[testName] == null; | ||
}).reduce((promise, testName) => { | ||
if (typeof defaultModules[testName] !== "function") { | ||
@@ -37,3 +50,5 @@ return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
}); | ||
}, Promise.resolve()).catch((error) => { | ||
}, prepare()).then(()=>{ | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
@@ -40,0 +55,0 @@ }); |
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
68828
1299