Skip to content

Commit

Permalink
fix: update stopped working with banner (#22)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laggingreflex authored and gajus committed Nov 30, 2016
1 parent 219f546 commit 5839536
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint-disable */

// @create-index
5 changes: 5 additions & 0 deletions test/validateTargetDirectory.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ describe('validateTargetDirectory()', () => {
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', () => {
it('throws an error', () => {
expect(() => {
Expand Down

0 comments on commit 5839536

Please sign in to comment.