Skip to content

Commit 885bd8a

Browse files
songhn233AdeAttwood
authored andcommitted
test(load): recursive extends with ts file
1 parent 08f64f9 commit 885bd8a

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type {UserConfig} from './types';
2+
3+
const Configuration: UserConfig = {
4+
extends: ['./first-extended'],
5+
rules: {
6+
zero: [0, 'never', 'zero']
7+
}
8+
};
9+
module.exports = Configuration;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type {UserConfig} from '../types';
2+
module.exports = {
3+
extends: ['./second-extended'],
4+
rules: {
5+
one: [1, 'never', 'one']
6+
}
7+
} as UserConfig;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type {UserConfig} from '../../types';
2+
module.exports = {
3+
rules: {
4+
two: [2, 'never', 'two']
5+
}
6+
} as UserConfig;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export interface UserConfig {
2+
extends?: string[];
3+
formatter?: string;
4+
rules?: any;
5+
parserPreset?: any;
6+
ignores?: ((commit: string) => boolean)[];
7+
defaultIgnores?: boolean;
8+
plugins?: (string | Plugin)[];
9+
helpUrl?: string;
10+
prompt?: any;
11+
}

@commitlint/load/src/load.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,22 @@ test('recursive extends with package.json file', async () => {
248248
});
249249
});
250250

251+
test('recursive extends with ts file', async () => {
252+
const cwd = await gitBootstrap('fixtures/recursive-extends-ts');
253+
const actual = await load({}, {cwd});
254+
255+
expect(actual).toMatchObject({
256+
formatter: '@commitlint/format',
257+
extends: ['./first-extended'],
258+
plugins: {},
259+
rules: {
260+
zero: [0, 'never', 'zero'],
261+
one: [1, 'never', 'one'],
262+
two: [2, 'never', 'two'],
263+
},
264+
});
265+
});
266+
251267
test('parser preset overwrites completely instead of merging', async () => {
252268
const cwd = await gitBootstrap('fixtures/parser-preset-override');
253269
const actual = await load({}, {cwd});

0 commit comments

Comments
 (0)