Skip to content

Commit a4397af

Browse files
committed
test: add case for #399
1 parent fa7aedb commit a4397af

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

@commitlint/parse/src/index.test.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,23 @@ test('uses restrictive default regex in passed parser opts', async t => {
186186
});
187187

188188
t.is(actual.subject, null);
189-
t.is(actual.message, undefined);
189+
t.is(actual.scope, null);
190+
});
191+
192+
test('works with chinese scope by default', async t => {
193+
const message = 'fix(面试评价): 测试';
194+
const actual = await parse(message, undefined, {commentChar: '#'});
195+
196+
t.not(actual.subject, null);
197+
t.not(actual.scope, null);
198+
});
199+
200+
test('does not work with chinese scopes with incompatible pattern', async t => {
201+
const message = 'fix(面试评价): 测试';
202+
const actual = await parse(message, undefined, {
203+
headerPattern: /^(\w*)(?:\(([a-z]*)\))?: (.*)$/
204+
});
205+
206+
t.is(actual.subject, null);
190207
t.is(actual.scope, null);
191208
});

0 commit comments

Comments
 (0)