Comparing version 0.1.7 to 0.1.8
@@ -83,5 +83,10 @@ #!/usr/bin/env node | ||
const expected = JSON.stringify(callCase.pop()); | ||
const result = JSON.stringify(target(...callCase)); | ||
const targetResult = target(...callCase); | ||
const result = JSON.stringify(targetResult); | ||
const callArgs = callCase.map(el => JSON.stringify(el)).join(', '); | ||
const args = `arguments: (${callArgs})`; | ||
if (result !== expected) { | ||
throw new Error(`Case failed: expected ${expected}, result: ${result}`); | ||
throw new Error( | ||
`Case failed: ${args}, expected: ${expected}, result: ${result}` | ||
); | ||
} | ||
@@ -123,5 +128,11 @@ } | ||
} catch (e) { | ||
console.log(concolor` Error: ${e.message}(b,red)`); | ||
const lines = e.stack.split('\n'); | ||
if (lines[1].includes('at Object.test')) { | ||
console.log(concolor` Error: ${e.message}(b,red)`); | ||
} else { | ||
const stack = lines.filter(s => !s.includes('hpw.js')).join('\n '); | ||
console.log(concolor` Error: ${stack}(b,red)`); | ||
} | ||
} | ||
} | ||
})(); |
{ | ||
"name": "hpw", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Labs Auto Checker", |
13531
441