-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(git-ignore): defined very rough first pass of a lifter
- Loading branch information
Showing
4 changed files
with
43 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {default as scaffold} from './scaffolder.js'; | ||
export {default as test} from './tester.js'; | ||
export {default as lift} from './lifter.js'; |
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,7 @@ | ||
import writeIgnores from './scaffolder.js'; | ||
|
||
export default async function ({projectRoot, results: {vcsIgnore}}) { | ||
if (vcsIgnore) await writeIgnores({projectRoot, ...vcsIgnore}); | ||
|
||
return {}; | ||
} |
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,32 @@ | ||
import {describe, it, expect, vi, afterEach} from 'vitest'; | ||
import any from '@travi/any'; | ||
|
||
import writeIgnores from './scaffolder.js'; | ||
import liftGitIgnore from './lifter.js'; | ||
|
||
vi.mock('./scaffolder.js'); | ||
|
||
describe('gitignore lifter', () => { | ||
const projectRoot = any.string(); | ||
|
||
afterEach(() => { | ||
vi.clearAllMocks(); | ||
}); | ||
|
||
it('should write the provided ignores to the gitignore file', async () => { | ||
const ignoredDirectories = any.listOf(any.word); | ||
const ignoredFiles = any.listOf(any.word); | ||
|
||
expect( | ||
await liftGitIgnore({projectRoot, results: {vcsIgnore: {directories: ignoredDirectories, files: ignoredFiles}}}) | ||
).toEqual({}); | ||
|
||
expect(writeIgnores).toHaveBeenCalledWith({projectRoot, directories: ignoredDirectories, files: ignoredFiles}); | ||
}); | ||
|
||
it('should not update the ignore file if no additional ignores are provided', async () => { | ||
expect(await liftGitIgnore({projectRoot, results: {}})).toEqual({}); | ||
|
||
expect(writeIgnores).not.toHaveBeenCalledWith({projectRoot}); | ||
}); | ||
}); |
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