baset-core
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.2.2"></a> | ||
## [0.2.2](https://github.com/Igmat/baset/compare/v0.2.1...v0.2.2) (2018-01-22) | ||
### Bug Fixes | ||
* **Core:** Adding beautifier for JSON output and using relative pathes in console ([bc81077](https://github.com/Igmat/baset/commit/bc81077)) | ||
<a name="0.2.1"></a> | ||
@@ -8,0 +19,0 @@ ## [0.2.1](https://github.com/Igmat/baset/compare/v0.2.0...v0.2.1) (2018-01-18) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require("fs"); | ||
const beautify = require("json-beautify"); | ||
const path = require("path"); | ||
function test(specs, baselines) { | ||
const files = specs.map(name => ({ | ||
name, | ||
output: JSON.stringify(require(name)), | ||
output: beautify(require(path.resolve(name)), undefined, 4, 20), | ||
})); | ||
files.forEach(file => { | ||
const baselinePath = file.name.replace(/.spec.js$/, '.base'); | ||
const baselinePath = path.resolve(file.name.replace(/.spec.js$/, '.base')); | ||
const baseline = fs.existsSync(baselinePath) | ||
? fs.readFileSync(baselinePath, { encoding: 'utf-8' }) | ||
: false; | ||
fs.writeFile(file.name.replace(/.spec.js$/, '.base.tmp'), file.output, err => { | ||
fs.writeFile(path.resolve(file.name.replace(/.spec.js$/, '.base.tmp')), file.output, err => { | ||
if (err) | ||
@@ -29,7 +31,7 @@ return console.log(err); | ||
files.forEach(file => { | ||
const baseline = fs.readFileSync(file, { encoding: 'utf-8' }); | ||
const baseline = fs.readFileSync(path.resolve(file), { encoding: 'utf-8' }); | ||
const filePath = file.replace(/.tmp$/, ''); | ||
fs.writeFile(filePath, baseline, err => { | ||
fs.writeFile(path.resolve(filePath), baseline, err => { | ||
console.log(err || `Baseline ${filePath} is written.`); | ||
fs.unlinkSync(file); | ||
fs.unlinkSync(path.resolve(file)); | ||
}); | ||
@@ -36,0 +38,0 @@ }); |
{ | ||
"name": "baset-core", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "", | ||
@@ -17,5 +17,9 @@ "main": "dist/index.js", | ||
"@types/node": "^9.3.0", | ||
"baset": "^0.2.2", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.6.2" | ||
}, | ||
"dependencies": { | ||
"json-beautify": "^1.0.1" | ||
} | ||
} |
import * as fs from 'fs'; | ||
import * as beautify from 'json-beautify'; | ||
import * as path from 'path'; | ||
@@ -6,6 +8,6 @@ export function test(specs: string[], baselines: string[]) { | ||
name, | ||
output: JSON.stringify(require(name)), | ||
output: beautify(require(path.resolve(name)), undefined, 4, 20), | ||
})); | ||
files.forEach(file => { | ||
const baselinePath = file.name.replace(/.spec.js$/, '.base'); | ||
const baselinePath = path.resolve(file.name.replace(/.spec.js$/, '.base')); | ||
const baseline = fs.existsSync(baselinePath) | ||
@@ -15,3 +17,3 @@ ? fs.readFileSync(baselinePath, { encoding: 'utf-8'}) | ||
fs.writeFile( | ||
file.name.replace(/.spec.js$/, '.base.tmp'), | ||
path.resolve(file.name.replace(/.spec.js$/, '.base.tmp')), | ||
file.output, | ||
@@ -31,12 +33,12 @@ err => { | ||
files.forEach(file => { | ||
const baseline = fs.readFileSync(file, { encoding: 'utf-8' }); | ||
const baseline = fs.readFileSync(path.resolve(file), { encoding: 'utf-8' }); | ||
const filePath = file.replace(/.tmp$/, ''); | ||
fs.writeFile( | ||
filePath, | ||
path.resolve(filePath), | ||
baseline, | ||
err => { | ||
console.log(err || `Baseline ${filePath} is written.`); | ||
fs.unlinkSync(file); | ||
fs.unlinkSync(path.resolve(file)); | ||
}); | ||
}); | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7659
9
118
1
4
+ Addedjson-beautify@^1.0.1
+ Addedjson-beautify@1.1.1(transitive)