clarity-cli
Advanced tools
Comparing version 1.0.12 to 1.0.13
{ | ||
"name": "clarity-cli", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Clarity setup for vscode.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,21 +6,32 @@ var fs = require("fs-extra"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"prepare": true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
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; | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
var prepare = promisify(defaultModules.prepare); | ||
var destroy = promisify(defaultModules.destroy); | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
Object.keys(defaultModules).filter((testName) => { | ||
return specialTestNames[testName] == null; | ||
@@ -49,3 +60,3 @@ }).reduce((promise, testName) => { | ||
}); | ||
}, prepare()).then(()=>{ | ||
}, prepare()).then(() => { | ||
return destroy(); | ||
@@ -52,0 +63,0 @@ }).catch((error) => { |
@@ -6,21 +6,32 @@ var fs = require("fs-extra"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"prepare": true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
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; | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
var prepare = promisify(defaultModules.prepare); | ||
var destroy = promisify(defaultModules.destroy); | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
Object.keys(defaultModules).filter((testName) => { | ||
return specialTestNames[testName] == null; | ||
@@ -49,3 +60,3 @@ }).reduce((promise, testName) => { | ||
}); | ||
}, prepare()).then(()=>{ | ||
}, prepare()).then(() => { | ||
return destroy(); | ||
@@ -52,0 +63,0 @@ }).catch((error) => { |
@@ -6,21 +6,32 @@ var fs = require("fs-extra"); | ||
const specialTestNames = { | ||
"prepare":true, | ||
"prepare": true, | ||
"destroy": true | ||
}; | ||
const promiseFunction = ()=>{ | ||
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; | ||
var prepare = defaultModules.prepare || promiseFunction; | ||
var destroy = defaultModules.destroy || promiseFunction; | ||
var prepare = promisify(defaultModules.prepare); | ||
var destroy = promisify(defaultModules.destroy); | ||
Object.keys(defaultModules).filter((testName)=>{ | ||
Object.keys(defaultModules).filter((testName) => { | ||
return specialTestNames[testName] == null; | ||
@@ -49,3 +60,3 @@ }).reduce((promise, testName) => { | ||
}); | ||
}, prepare()).then(()=>{ | ||
}, prepare()).then(() => { | ||
return destroy(); | ||
@@ -52,0 +63,0 @@ }).catch((error) => { |
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
69431
1323