1 Commits
Author SHA1 Message Date
laggingreflexandGajus Kuizinas 5839536cf0 fix: update stopped working with banner (#22)
With the addition of `--banner` option index files no longer start with '// @create-index'

This new regex looks for '// @create-index' that are either at the beginning of the file (old behavior) or if it is followed by a newline.
Basically it just checks whether it exists in a file or not.

Added a test for it now.

# Conflicts:
#	src/utilities/validateTargetDirectory.js
2016-11-30 13:20:50 +00:00
2 changed files with 8 additions and 0 deletions
@@ -0,0 +1,3 @@
/* eslint-disable */
// @create-index
+5
View File
@@ -36,6 +36,11 @@ describe('validateTargetDirectory()', () => {
expect(validateTargetDirectory(path.resolve(fixturesPath, 'safe-index'))).to.equal(true); expect(validateTargetDirectory(path.resolve(fixturesPath, 'safe-index'))).to.equal(true);
}); });
}); });
context('safe with banner', () => {
it('returns true', () => {
expect(validateTargetDirectory(path.resolve(fixturesPath, 'safe-index-with-banner'))).to.equal(true);
});
});
context('unsafe', () => { context('unsafe', () => {
it('throws an error', () => { it('throws an error', () => {
expect(() => { expect(() => {