baset-core
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.3.0"></a> | ||
# [0.3.0](https://github.com/Igmat/baset/compare/v0.2.2...v0.3.0) (2018-01-23) | ||
### Bug Fixes | ||
* **CLI:** Non-zero exit code for fail and more informative message ([1aaff03](https://github.com/Igmat/baset/commit/1aaff03)), closes [#2](https://github.com/Igmat/baset/issues/2) | ||
<a name="0.2.2"></a> | ||
@@ -8,0 +19,0 @@ ## [0.2.2](https://github.com/Igmat/baset/compare/v0.2.1...v0.2.2) (2018-01-22) |
@@ -1,2 +0,2 @@ | ||
export declare function test(specs: string[], baselines: string[]): void; | ||
export declare function test(specs: string[], baselines: string[]): Promise<string>[]; | ||
export declare function accept(files: string[]): void; |
@@ -11,3 +11,3 @@ "use strict"; | ||
})); | ||
files.forEach(file => { | ||
return files.map(file => new Promise((resolve, reject) => { | ||
const baselinePath = path.resolve(file.name.replace(/.spec.js$/, '.base')); | ||
@@ -18,12 +18,19 @@ const baseline = fs.existsSync(baselinePath) | ||
fs.writeFile(path.resolve(file.name.replace(/.spec.js$/, '.base.tmp')), file.output, err => { | ||
if (err) | ||
return console.log(err); | ||
if (err) { | ||
console.log(err); | ||
return reject(err); | ||
} | ||
console.log(`Temp baseline for ${file.name} is written.`); | ||
if (!baseline) | ||
return; | ||
console.log((baseline === file.output) | ||
? 'Test passed' | ||
: 'Test failed'); | ||
if (baseline === file.output) { | ||
resolve(`Test for ${file.name} is passed`); | ||
} | ||
else { | ||
reject({ | ||
name: file.name, | ||
expected: baseline || '', | ||
actual: file.output, | ||
}); | ||
} | ||
}); | ||
}); | ||
})); | ||
} | ||
@@ -30,0 +37,0 @@ exports.test = test; |
{ | ||
"name": "baset-core", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
"@types/node": "^9.3.0", | ||
"baset": "^0.2.2", | ||
"baset": "^0.3.0", | ||
"tslint": "^5.9.1", | ||
@@ -20,0 +20,0 @@ "typescript": "^2.6.2" |
Sorry, the diff of this file is not supported yet
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
5966
5
48