Comparing version 1.0.1 to 1.0.2
@@ -9,4 +9,4 @@ { | ||
"verbose": true, | ||
"include": ["a.ts$"], | ||
"include": [".ts$"], | ||
"exclude": ["zeta.ts$"] | ||
} |
@@ -29,2 +29,6 @@ "use strict"; | ||
const destination = path.join(directory.path, options.barrelName); | ||
if (content.length === 0) { | ||
// Skip empty barrels. | ||
return; | ||
} | ||
fs.writeFileSync(destination, content); | ||
@@ -31,0 +35,0 @@ // Update the file tree model with the new barrel. |
@@ -95,2 +95,36 @@ "use strict"; | ||
}); | ||
describe("buildBarrels function with empty barrel content that", () => { | ||
let directory; | ||
let spySandbox; | ||
let logger; | ||
const runBuilder = () => { | ||
logger = spySandbox.spy(); | ||
Builder.buildBarrels(directory.directories, { | ||
barrelName: "barrel.ts", | ||
logger, | ||
quoteCharacter: "\"", | ||
rootPath: ".", | ||
structure: "flat", | ||
}); | ||
}; | ||
beforeEach(() => { | ||
MockFs(TestUtilities.mockFsConfiguration()); | ||
directory = TestUtilities.mockDirectoryTree(); | ||
spySandbox = Sinon.createSandbox(); | ||
spySandbox.stub(Flat, "buildFlatBarrel").returns(""); | ||
spySandbox.stub(Modules, "loadDirectoryModules").returns("loadedModules"); | ||
}); | ||
afterEach(() => { | ||
MockFs.restore(); | ||
spySandbox.restore(); | ||
}); | ||
it("does not create an empty barrel", () => { | ||
runBuilder(); | ||
const checkDoesNotExist = (address) => { | ||
chai_1.assert.isFalse(fs.existsSync(address)); | ||
}; | ||
checkDoesNotExist("directory1/directory2/barrel.ts"); | ||
checkDoesNotExist("directory1/directory3/barrel.ts"); | ||
}); | ||
}); | ||
describe("buildImportPath function that", () => { | ||
@@ -97,0 +131,0 @@ let directory; |
@@ -116,4 +116,4 @@ "use strict"; | ||
} | ||
console.info(configuration.rules.get("quotemark")); //tslint:disable-line | ||
linter.lint("test_output.ts", content, configuration); | ||
/* istanbul ignore next: Should not be hit during successful test execution. */ | ||
const failures = linter.getResult().failures.map((failure) => `${failure.getRuleName()} ${failure.getStartPosition().getLineAndCharacter().line}`); | ||
@@ -120,0 +120,0 @@ chai_1.assert.deepEqual(failures, []); |
{ | ||
"name": "barrelsby", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Automatic TypeScript barrels for your entire code base", | ||
@@ -13,4 +13,5 @@ "main": "index.js", | ||
"tests_unit": "istanbul cover --report json --root \"./bin\" -x \"**/*.test.js\" node_modules/mocha/bin/_mocha \"bin/**/*.test.js\"", | ||
"remap_coverage_html": "remap-istanbul -i coverage/coverage-final.json -t lcovonly -o coverage/lcov.info", | ||
"tests": "npm run tests_unit && npm run tests_integration && npm run remap_coverage_html", | ||
"remap_coverage": "remap-istanbul -i coverage/coverage-final.json -t json -o coverage/coverage-final.json && rimraf coverage/coverage.json", | ||
"html_coverage": "istanbul report html", | ||
"tests": "npm run tests_unit && npm run tests_integration && npm run remap_coverage", | ||
"test": "npm run build && npm run tests" | ||
@@ -39,18 +40,18 @@ }, | ||
"devDependencies": { | ||
"@types/chai": "^4.0.2", | ||
"@types/mocha": "^5.0.0", | ||
"@types/chai": "^4.1.3", | ||
"@types/mocha": "^5.2.1", | ||
"@types/mock-fs": "^3.6.30", | ||
"@types/node": "^10.0.3", | ||
"@types/sinon": "^5.0.0", | ||
"@types/sinon-chai": "^2.7.28", | ||
"chai": "^4.1.1", | ||
"@types/node": "^10.3.1", | ||
"@types/sinon": "^5.0.1", | ||
"@types/sinon-chai": "^2.7.32", | ||
"chai": "^4.1.2", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.0.0", | ||
"mock-fs": "^4.4.1", | ||
"remap-istanbul": "^0.11.0", | ||
"mocha": "^5.2.0", | ||
"mock-fs": "^4.5.0", | ||
"remap-istanbul": "^0.11.1", | ||
"rimraf": "^2.6.2", | ||
"sinon": "^5.0.10", | ||
"sinon-chai": "^3.0.0", | ||
"tslint": "^5.5.0", | ||
"typescript": "^2.8.3" | ||
"sinon": "^5.1.0", | ||
"sinon-chai": "^3.1.0", | ||
"tslint": "^5.10.0", | ||
"typescript": "^2.9.1" | ||
}, | ||
@@ -57,0 +58,0 @@ "bin": { |
@@ -99,2 +99,38 @@ import {assert} from "chai"; | ||
}); | ||
describe("buildBarrels function with empty barrel content that", () => { | ||
let directory: Directory; | ||
let spySandbox: sinon.SinonSandbox; | ||
let logger: Sinon.SinonSpy; | ||
const runBuilder = () => { | ||
logger = spySandbox.spy(); | ||
Builder.buildBarrels( | ||
directory.directories, | ||
{ | ||
barrelName: "barrel.ts", | ||
logger, | ||
quoteCharacter: "\"", | ||
rootPath: ".", | ||
structure: "flat", | ||
}); | ||
}; | ||
beforeEach(() => { | ||
MockFs(TestUtilities.mockFsConfiguration()); | ||
directory = TestUtilities.mockDirectoryTree(); | ||
spySandbox = Sinon.createSandbox(); | ||
spySandbox.stub(Flat, "buildFlatBarrel").returns(""); | ||
spySandbox.stub(Modules, "loadDirectoryModules").returns("loadedModules"); | ||
}); | ||
afterEach(() => { | ||
MockFs.restore(); | ||
spySandbox.restore(); | ||
}); | ||
it("does not create an empty barrel", () => { | ||
runBuilder(); | ||
const checkDoesNotExist = (address: string) => { | ||
assert.isFalse(fs.existsSync(address)); | ||
}; | ||
checkDoesNotExist("directory1/directory2/barrel.ts"); | ||
checkDoesNotExist("directory1/directory3/barrel.ts"); | ||
}); | ||
}); | ||
describe("buildImportPath function that", () => { | ||
@@ -101,0 +137,0 @@ let directory: Directory; |
@@ -31,2 +31,6 @@ import * as fs from "fs"; | ||
const destination = path.join(directory.path, options.barrelName); | ||
if (content.length === 0) { | ||
// Skip empty barrels. | ||
return; | ||
} | ||
fs.writeFileSync(destination, content); | ||
@@ -33,0 +37,0 @@ // Update the file tree model with the new barrel. |
@@ -121,8 +121,8 @@ import {assert} from "chai"; | ||
} | ||
console.info(configuration.rules.get("quotemark")); //tslint:disable-line | ||
linter.lint("test_output.ts", content, configuration); | ||
const failures = linter.getResult().failures.map((failure) => | ||
`${failure.getRuleName()} ${failure.getStartPosition().getLineAndCharacter().line}`, | ||
/* istanbul ignore next: Should not be hit during successful test execution. */ | ||
const failures = linter.getResult().failures.map( | ||
(failure) => `${failure.getRuleName()} ${failure.getStartPosition().getLineAndCharacter().line}`, | ||
); | ||
assert.deepEqual(failures, []); | ||
} |
import * as alphabetats from "test/alpha/beta"; | ||
import * as etats from "test/eta"; | ||
import * as gammadeltaepsilonts from "test/gamma/delta/epsilon"; | ||
export const alpha = { | ||
@@ -7,1 +8,6 @@ beta: alphabetats, | ||
export {etats as eta}; | ||
export const gamma = { | ||
delta: { | ||
epsilon: gammadeltaepsilonts, | ||
}, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
168008
79
2813