-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement monorepo support (#8)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
- Loading branch information
1 parent
c65fc6d
commit aadca59
Showing
9 changed files
with
207 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import ignore from '../src/index' | ||
|
||
describe('should execute tests in test/workspace-with-gitignore', () => { | ||
process.chdir('test/workspace-with-gitignore') | ||
|
||
it('should find a gitignore file', () => { | ||
expect(ignore()) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [ | ||
"gitignoretest", | ||
"**/gitignoretest/**", | ||
], | ||
} | ||
`) | ||
}) | ||
|
||
it('strict (default) throw', () => { | ||
expect(() => ignore({ files: 'not-exists', root: true })) | ||
.toThrow() | ||
}) | ||
|
||
it('not strict skip missing file', () => { | ||
expect(ignore({ files: 'not-exists', strict: false, root: true })) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [], | ||
} | ||
`) | ||
}) | ||
|
||
it('should find a gitignore file in cwd', () => { | ||
expect(ignore({ root: true })) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [ | ||
"gitignoretest", | ||
"**/gitignoretest/**", | ||
], | ||
} | ||
`) | ||
}) | ||
|
||
it('dont fallback to root, strict and return empty array', () => { | ||
expect(ignore({ strict: false, root: true })) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [ | ||
"gitignoretest", | ||
"**/gitignoretest/**", | ||
], | ||
} | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gitignoretest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import ignore from '../src/index' | ||
|
||
describe('should execute tests in test/workspace-without-gitignore', () => { | ||
process.chdir('test/workspace-without-gitignore') | ||
|
||
it('should find a gitignore file', () => { | ||
expect(ignore()) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [ | ||
".cache", | ||
"**/.cache/**", | ||
".DS_Store", | ||
"**/.DS_Store/**", | ||
".idea", | ||
"**/.idea/**", | ||
"*.log", | ||
"**/*.log/**", | ||
"*.tgz", | ||
"**/*.tgz/**", | ||
"coverage", | ||
"**/coverage/**", | ||
"dist", | ||
"**/dist/**", | ||
"lib-cov", | ||
"**/lib-cov/**", | ||
"logs", | ||
"**/logs/**", | ||
"node_modules", | ||
"**/node_modules/**", | ||
"temp", | ||
"**/temp/**", | ||
"!temp/.gitkeep", | ||
"!temp/.gitkeep/**", | ||
], | ||
} | ||
`) | ||
}) | ||
|
||
it('strict (default) throw', () => { | ||
expect(() => ignore({ files: 'not-exists', root: true })) | ||
.toThrow() | ||
}) | ||
|
||
it('not strict skip missing file', () => { | ||
expect(ignore({ files: 'not-exists', strict: false, root: true })) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [], | ||
} | ||
`) | ||
}) | ||
|
||
it('dont fallback to root, strict and throw error', () => { | ||
expect(() => ignore({ root: true })) | ||
.toThrow() | ||
}) | ||
|
||
it('dont fallback to root, no strict and return empty array', () => { | ||
expect(ignore({ strict: false, root: true })) | ||
.toMatchInlineSnapshot(` | ||
{ | ||
"ignores": [], | ||
} | ||
`) | ||
}) | ||
}) |
Empty file.