Skip to content

Commit 5839536

Browse files
laggingreflexgajus
authored andcommitted
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
1 parent 219f546 commit 5839536

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint-disable */
2+
3+
// @create-index

test/validateTargetDirectory.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ describe('validateTargetDirectory()', () => {
3636
expect(validateTargetDirectory(path.resolve(fixturesPath, 'safe-index'))).to.equal(true);
3737
});
3838
});
39+
context('safe with banner', () => {
40+
it('returns true', () => {
41+
expect(validateTargetDirectory(path.resolve(fixturesPath, 'safe-index-with-banner'))).to.equal(true);
42+
});
43+
});
3944
context('unsafe', () => {
4045
it('throws an error', () => {
4146
expect(() => {

0 commit comments

Comments
 (0)