clarity-cli
Advanced tools
Comparing version 1.0.17 to 1.0.18
{ | ||
"name": "clarity-cli", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"description": "Clarity setup for vscode.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
var fs = require("fs-extra"); | ||
var path = require("path"); | ||
const seperator = "============================================================"; | ||
const startSeperator = "************************************************************"; | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
const specialTestNames = { | ||
"prepare": true, | ||
"destroy": true, | ||
"clean": true | ||
}; | ||
const promiseFunction = () => { | ||
return Promise.resolve(null); | ||
} | ||
const promisify = (fn) => { | ||
return () => { | ||
fn = fn || promiseFunction; | ||
var result = fn(); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
return result; | ||
} | ||
} | ||
fs.readdir(testDirectory).then((files) => { | ||
files.forEach((file) => { | ||
if (path.extname(file) === ".js") { | ||
var tests = require(path.join(testDirectory, file)); | ||
var defaultModules = tests.default || tests; | ||
return files.reduce((promise, file) => { | ||
Object.keys(defaultModules).reduce((promise, testName) => { | ||
if (typeof defaultModules[testName] !== "function") { | ||
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
return promise.then(() => { | ||
if (path.extname(file) === ".js") { | ||
console.log(startSeperator); | ||
console.log(file); | ||
console.log(startSeperator); | ||
try { | ||
var tests = require(path.join(testDirectory, file)); | ||
} catch (error) { | ||
console.log("REQUIRE ERROR: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
return Promise.resolve(); | ||
} | ||
return promise.then(() => { | ||
try { | ||
var defaultModules = tests.default || tests; | ||
var prepare = promisify(defaultModules.prepare); | ||
var destroy = promisify(defaultModules.destroy); | ||
var clean = promisify(defaultModules.clean); | ||
var preparePromise = prepare().catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON PREPARE: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
return Promise.reject(); | ||
}); | ||
return Object.keys(defaultModules).filter((testName) => { | ||
return specialTestNames[testName] == null; | ||
}).reduce((promise, testName) => { | ||
if (typeof defaultModules[testName] !== "function") { | ||
console.log("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
return promise.then(() => { | ||
return Promise.resolve(); | ||
}); | ||
} | ||
return promise.then(() => { | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
return result.then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
}); | ||
} catch (error) { | ||
return result; | ||
}).then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return clean(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON CLEAN"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}); | ||
return Promise.reject(error); | ||
} | ||
}, preparePromise).then(() => { | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON DESTROY"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
console.log(startSeperator); | ||
console.log("\n\n"); | ||
}); | ||
}, Promise.resolve()).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
}); | ||
} | ||
}); | ||
}).catch(() => { | ||
} | ||
return Promise.resolve(); | ||
}).then(() => { | ||
}); | ||
}, Promise.resolve()); | ||
}).catch((error) => { | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
}); |
{ | ||
"name": "babel", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "./lib/index.js", | ||
"scripts": { | ||
"test": "node ./.clarity/test.js", | ||
"build": "node ./.clarity/build.js" | ||
}, | ||
"keywords": [], | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-env": "^1.5.1", | ||
"child-process-es6-promise": "^1.1.0", | ||
"fs-extra": "^3.0.1", | ||
"istanbul": "^0.4.5", | ||
"jsdoc": "^3.4.3", | ||
"express": "^3.4.3" | ||
}, | ||
"dependencies": {} | ||
} | ||
"name": "babel", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "./lib/index.js", | ||
"scripts": { | ||
"test": "node ./.clarity/test.js", | ||
"build": "node ./.clarity/build.js" | ||
}, | ||
"keywords": [], | ||
"devDependencies": { | ||
"babel-cli": "^6.24.1", | ||
"babel-preset-env": "^1.5.1", | ||
"child-process-es6-promise": "^1.1.0", | ||
"fs-extra": "^3.0.1", | ||
"istanbul": "^0.4.5", | ||
"jsdoc": "^3.4.3", | ||
"express": "^3.4.3" | ||
}, | ||
"dependencies": {} | ||
} |
var fs = require("fs-extra"); | ||
var path = require("path"); | ||
const seperator = "============================================================"; | ||
const startSeperator = "************************************************************"; | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
@@ -26,6 +29,3 @@ const specialTestNames = { | ||
fs.readdir(testDirectory).catch(() => { | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
return []; | ||
}).then((files) => { | ||
fs.readdir(testDirectory).then((files) => { | ||
return files.reduce((promise, file) => { | ||
@@ -35,6 +35,17 @@ | ||
if (path.extname(file) === ".js") { | ||
console.log(startSeperator); | ||
console.log(file); | ||
console.log(startSeperator); | ||
try { | ||
var tests = require(path.join(testDirectory, file)); | ||
} catch (error) { | ||
console.log("REQUIRE ERROR: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
var tests = require(path.join(testDirectory, file)); | ||
return Promise.resolve(); | ||
} | ||
var defaultModules = tests.default || tests; | ||
var prepare = promisify(defaultModules.prepare); | ||
@@ -44,2 +55,11 @@ var destroy = promisify(defaultModules.destroy); | ||
var preparePromise = prepare().catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON PREPARE: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
return Promise.reject(); | ||
}); | ||
return Object.keys(defaultModules).filter((testName) => { | ||
@@ -50,39 +70,40 @@ return specialTestNames[testName] == null; | ||
if (typeof defaultModules[testName] !== "function") { | ||
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
console.log("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
return promise.then(() => { | ||
return Promise.resolve(); | ||
}); | ||
} | ||
return promise.then(() => { | ||
try { | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
return result.then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
}); | ||
} catch (error) { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
return Promise.resolve(null); | ||
} | ||
return result; | ||
}).then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return clean(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON CLEAN"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}); | ||
}, prepare()).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
}, preparePromise).then(() => { | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON DESTROY"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return destroy(); | ||
console.log(startSeperator); | ||
console.log("\n\n"); | ||
}); | ||
@@ -92,8 +113,8 @@ } | ||
return Promise.resolve(); | ||
}).then(() => { | ||
}); | ||
}, Promise.resolve()); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: " + error.message); | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
}); |
var fs = require("fs-extra"); | ||
var path = require("path"); | ||
const seperator = "============================================================"; | ||
const startSeperator = "************************************************************"; | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
@@ -26,6 +29,3 @@ const specialTestNames = { | ||
fs.readdir(testDirectory).catch(() => { | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
return []; | ||
}).then((files) => { | ||
fs.readdir(testDirectory).then((files) => { | ||
return files.reduce((promise, file) => { | ||
@@ -35,6 +35,17 @@ | ||
if (path.extname(file) === ".js") { | ||
console.log(startSeperator); | ||
console.log(file); | ||
console.log(startSeperator); | ||
try { | ||
var tests = require(path.join(testDirectory, file)); | ||
} catch (error) { | ||
console.log("REQUIRE ERROR: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
var tests = require(path.join(testDirectory, file)); | ||
return Promise.resolve(); | ||
} | ||
var defaultModules = tests.default || tests; | ||
var prepare = promisify(defaultModules.prepare); | ||
@@ -44,2 +55,11 @@ var destroy = promisify(defaultModules.destroy); | ||
var preparePromise = prepare().catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON PREPARE: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
return Promise.reject(); | ||
}); | ||
return Object.keys(defaultModules).filter((testName) => { | ||
@@ -50,39 +70,40 @@ return specialTestNames[testName] == null; | ||
if (typeof defaultModules[testName] !== "function") { | ||
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
console.log("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
return promise.then(() => { | ||
return Promise.resolve(); | ||
}); | ||
} | ||
return promise.then(() => { | ||
try { | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
return result.then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
}); | ||
} catch (error) { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
return Promise.resolve(null); | ||
} | ||
return result; | ||
}).then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return clean(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON CLEAN"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}); | ||
}, prepare()).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
}, preparePromise).then(() => { | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON DESTROY"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return destroy(); | ||
console.log(startSeperator); | ||
console.log("\n\n"); | ||
}); | ||
@@ -92,8 +113,8 @@ } | ||
return Promise.resolve(); | ||
}).then(() => { | ||
}); | ||
}, Promise.resolve()); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: " + error.message); | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
}); |
var fs = require("fs-extra"); | ||
var path = require("path"); | ||
const seperator = "============================================================"; | ||
const startSeperator = "************************************************************"; | ||
const testDirectory = path.join(__dirname, "../lib/tests"); | ||
@@ -26,6 +29,3 @@ const specialTestNames = { | ||
fs.readdir(testDirectory).catch(() => { | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
return []; | ||
}).then((files) => { | ||
fs.readdir(testDirectory).then((files) => { | ||
return files.reduce((promise, file) => { | ||
@@ -35,6 +35,17 @@ | ||
if (path.extname(file) === ".js") { | ||
console.log(startSeperator); | ||
console.log(file); | ||
console.log(startSeperator); | ||
try { | ||
var tests = require(path.join(testDirectory, file)); | ||
} catch (error) { | ||
console.log("REQUIRE ERROR: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
var tests = require(path.join(testDirectory, file)); | ||
return Promise.resolve(); | ||
} | ||
var defaultModules = tests.default || tests; | ||
var prepare = promisify(defaultModules.prepare); | ||
@@ -44,2 +55,11 @@ var destroy = promisify(defaultModules.destroy); | ||
var preparePromise = prepare().catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON PREPARE: " + file); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
return Promise.reject(); | ||
}); | ||
return Object.keys(defaultModules).filter((testName) => { | ||
@@ -50,39 +70,40 @@ return specialTestNames[testName] == null; | ||
if (typeof defaultModules[testName] !== "function") { | ||
return Promise.resolve("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
console.log("UNEXPECTED EXPORT: This export '" + testName + "' needs to be a function."); | ||
return promise.then(() => { | ||
return Promise.resolve(); | ||
}); | ||
} | ||
return promise.then(() => { | ||
try { | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
let result = defaultModules[testName](); | ||
result = result instanceof Promise ? result : Promise.resolve(result); | ||
return result.then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
}); | ||
} catch (error) { | ||
console.log("FAILED: " + testName); | ||
console.log(error); | ||
return Promise.resolve(null); | ||
} | ||
return result; | ||
}).then(() => { | ||
console.log("PASSED: " + testName); | ||
}).catch((error) => { | ||
console.log("FAILED: " + testName); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return clean(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON CLEAN"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}); | ||
}, prepare()).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: Most likely an async error."); | ||
}, preparePromise).then(() => { | ||
return destroy(); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE ON DESTROY"); | ||
console.log(seperator); | ||
console.log(error); | ||
console.log(seperator); | ||
}).then(() => { | ||
return destroy(); | ||
console.log(startSeperator); | ||
console.log("\n\n"); | ||
}); | ||
@@ -92,8 +113,8 @@ } | ||
return Promise.resolve(); | ||
}).then(() => { | ||
}); | ||
}, Promise.resolve()); | ||
}).catch((error) => { | ||
console.log("UNEXPECTED FAILURE: " + error.message); | ||
console.log(`Couldn't find test folder here: ${testDirectory}`); | ||
}); |
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
77091
1496
62