-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes GH-32.
- Loading branch information
Showing
4 changed files
with
122 additions
and
30 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,6 +1,7 @@ | ||
/** | ||
* @typedef {import('remark-contributors').Contributor} Contributor | ||
* @typedef {import('./lib/index.js').Filter} Filter | ||
* @typedef {import('./lib/index.js').Options} Options | ||
*/ | ||
|
||
export {default} from './lib/index.js' | ||
export {defaultFilter, default} from './lib/index.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
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* @property {boolean | null | undefined} [broken] | ||
* Break the `package.json` (default: `false`). | ||
* | ||
* @typedef {[string, string]} User | ||
* @typedef {[name: string, email: string]} User | ||
* User name and email. | ||
*/ | ||
|
||
|
@@ -59,7 +59,7 @@ test('remark-git-contributors', async function (t) { | |
await t.test('should expose the public api', async function () { | ||
assert.deepEqual( | ||
Object.keys(await import('remark-git-contributors')).sort(), | ||
['default'] | ||
['default', 'defaultFilter'] | ||
) | ||
}) | ||
|
||
|
@@ -356,6 +356,39 @@ test('remark-git-contributors', async function (t) { | |
} | ||
}) | ||
|
||
await t.test('should support a custom `filter`', async function () { | ||
const cwd = temporary() | ||
const [input] = await getFixtures('00') | ||
|
||
await createPackage(cwd) | ||
await createCommits(cwd, { | ||
users: [ | ||
['beep', '[email protected]'], | ||
['bea', 'äkta@människor.io'] | ||
] | ||
}) | ||
|
||
const file = await remark() | ||
.use(remarkGfm) | ||
.use(remarkGitContributors, { | ||
filter(d) { | ||
return d.name !== 'beep' | ||
} | ||
}) | ||
.process(new VFile({cwd, path: 'input.md', value: input})) | ||
|
||
assert.equal( | ||
String(file), | ||
'# Contributors\n\n| Name |\n| :------ |\n| **bea** |\n' | ||
) | ||
assert.deepEqual( | ||
file.messages.map(function (d) { | ||
return d.reason | ||
}), | ||
['Unexpected missing social handle for contributor `äkta@människor.io`'] | ||
) | ||
}) | ||
|
||
await t.test('should work w/ invalid twitter', async function () { | ||
const cwd = temporary() | ||
const [input, expected] = await getFixtures('00') | ||
|