Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: omit types file from test
  • Loading branch information
marionebl committed Feb 5, 2020
commit 456da74e6a737f28c80f3567bb348e937a82c0ba
6 changes: 5 additions & 1 deletion @commitlint/ensure/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import {camelCase, values} from 'lodash';
import * as ensure from '.';

test('exports all checkers', async () => {
const expected = (await glob('*.ts')).map(f => camelCase(f)).sort();
const ignore = ['types'];
const expected = (await glob('*.ts'))
.map(f => camelCase(f))
.sort()
.filter(item => !ignore.includes(item));
const actual = Object.keys(ensure).sort();
expect(actual).toEqual(expected);
Copy link
Contributor

@armano2 armano2 Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(actual).toEqual(expected);
expect(actual).toMatchObject(expected);

and you should be able to remove sorting

test('exports all checkers', async () => { const ignore = ['types']; const expected = (await glob('*.ts')) .map(f => camelCase(f)) .filter(item => !ignore.includes(item)); const actual = Object.keys(ensure); expect(actual).toMatchObject(expected); });

toMatchObject works on arrays

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know! I go with the current approach as this is supposed to test if we forgot to reexport any checker from the directory. So failing for a new file that is not exported from index.js is the expected behavior

});
Expand Down