Skip to content

Commit eba4002

Browse files
committed
test: drop unnecessary notThrowsAsync
1 parent 3ca5fd1 commit eba4002

File tree

1 file changed

+54
-71
lines changed

1 file changed

+54
-71
lines changed

@commitlint/cli/src/cli.test.js

+54-71
Original file line numberDiff line numberDiff line change
@@ -136,85 +136,70 @@ test('should produce no error output with -q flag', async t => {
136136
});
137137

138138
test('should work with husky commitmsg hook and git commit', async t => {
139-
await t.notThrowsAsync(async () => {
140-
const cwd = await git.bootstrap('fixtures/husky/integration');
141-
await writePkg({husky: {hooks: {'commit-msg': `'${bin}' -e`}}}, {cwd});
139+
const cwd = await git.bootstrap('fixtures/husky/integration');
140+
await writePkg({husky: {hooks: {'commit-msg': `'${bin}' -e`}}}, {cwd});
142141

143-
await execa('npm', ['install'], {cwd});
144-
await execa('git', ['add', 'package.json'], {cwd});
145-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
146-
});
142+
await execa('npm', ['install'], {cwd});
143+
await execa('git', ['add', 'package.json'], {cwd});
144+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
147145
});
148146

149147
test('should work with husky commitmsg hook in sub packages', async t => {
150-
await t.notThrowsAsync(async () => {
151-
const upper = await git.bootstrap('fixtures/husky');
152-
const cwd = path.join(upper, 'integration');
153-
await writePkg(
154-
{husky: {hooks: {'commit-msg': `'${bin}' -e`}}},
155-
{cwd: upper}
156-
);
148+
const upper = await git.bootstrap('fixtures/husky');
149+
const cwd = path.join(upper, 'integration');
150+
await writePkg({husky: {hooks: {'commit-msg': `'${bin}' -e`}}}, {cwd: upper});
157151

158-
await execa('npm', ['install'], {cwd});
159-
await execa('git', ['add', 'package.json'], {cwd});
160-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
161-
});
152+
await execa('npm', ['install'], {cwd});
153+
await execa('git', ['add', 'package.json'], {cwd});
154+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
162155
});
163156

164157
test('should work with husky via commitlint -e $GIT_PARAMS', async t => {
165-
await t.notThrowsAsync(async () => {
166-
const cwd = await git.bootstrap('fixtures/husky/integration');
167-
await writePkg(
168-
{husky: {hooks: {'commit-msg': `'${bin}' -e $GIT_PARAMS`}}},
169-
{cwd}
170-
);
158+
const cwd = await git.bootstrap('fixtures/husky/integration');
159+
await writePkg(
160+
{husky: {hooks: {'commit-msg': `'${bin}' -e $GIT_PARAMS`}}},
161+
{cwd}
162+
);
171163

172-
await execa('npm', ['install'], {cwd});
173-
await execa('git', ['add', 'package.json'], {cwd});
174-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
175-
});
164+
await execa('npm', ['install'], {cwd});
165+
await execa('git', ['add', 'package.json'], {cwd});
166+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
176167
});
177168

178169
test('should work with husky via commitlint -e %GIT_PARAMS%', async t => {
179-
await t.notThrowsAsync(async () => {
180-
const cwd = await git.bootstrap('fixtures/husky/integration');
181-
await writePkg(
182-
{husky: {hooks: {'commit-msg': `'${bin}' -e %GIT_PARAMS%`}}},
183-
{cwd}
184-
);
170+
const cwd = await git.bootstrap('fixtures/husky/integration');
171+
await writePkg(
172+
{husky: {hooks: {'commit-msg': `'${bin}' -e %GIT_PARAMS%`}}},
173+
{cwd}
174+
);
185175

186-
await execa('npm', ['install'], {cwd});
187-
await execa('git', ['add', 'package.json'], {cwd});
188-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
189-
});
176+
await execa('npm', ['install'], {cwd});
177+
await execa('git', ['add', 'package.json'], {cwd});
178+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
190179
});
191180

192181
test('should work with husky via commitlint -e $HUSKY_GIT_PARAMS', async t => {
193-
await t.notThrowsAsync(async () => {
194-
const cwd = await git.bootstrap('fixtures/husky/integration');
195-
await writePkg(
196-
{husky: {hooks: {'commit-msg': `'${bin}' -e $HUSKY_GIT_PARAMS`}}},
197-
{cwd}
198-
);
182+
const cwd = await git.bootstrap('fixtures/husky/integration');
183+
await writePkg(
184+
{husky: {hooks: {'commit-msg': `'${bin}' -e $HUSKY_GIT_PARAMS`}}},
185+
{cwd}
186+
);
199187

200-
await execa('npm', ['install'], {cwd});
201-
await execa('git', ['add', 'package.json'], {cwd});
202-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
203-
});
188+
await execa('npm', ['install'], {cwd});
189+
await execa('git', ['add', 'package.json'], {cwd});
190+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
204191
});
205192

206193
test('should work with husky via commitlint -e %HUSKY_GIT_PARAMS%', async t => {
207-
await t.notThrowsAsync(async () => {
208-
const cwd = await git.bootstrap('fixtures/husky/integration');
209-
await writePkg(
210-
{husky: {hooks: {'commit-msg': `'${bin}' -e %HUSKY_GIT_PARAMS%`}}},
211-
{cwd}
212-
);
194+
const cwd = await git.bootstrap('fixtures/husky/integration');
195+
await writePkg(
196+
{husky: {hooks: {'commit-msg': `'${bin}' -e %HUSKY_GIT_PARAMS%`}}},
197+
{cwd}
198+
);
213199

214-
await execa('npm', ['install'], {cwd});
215-
await execa('git', ['add', 'package.json'], {cwd});
216-
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
217-
});
200+
await execa('npm', ['install'], {cwd});
201+
await execa('git', ['add', 'package.json'], {cwd});
202+
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
218203
});
219204

220205
test('should allow reading of environment variables for edit file, succeeding if valid', async t => {
@@ -291,19 +276,17 @@ test('should pick up config from inside git repo with precedence and fail accord
291276
});
292277

293278
test('should handle --amend with signoff', async t => {
294-
await t.notThrowsAsync(async () => {
295-
const cwd = await git.bootstrap('fixtures/signoff');
296-
await writePkg({husky: {hooks: {'commit-msg': `'${bin}' -e`}}}, {cwd});
297-
298-
await execa('npm', ['install'], {cwd});
299-
await execa('git', ['add', 'package.json'], {cwd});
300-
await execa(
301-
'git',
302-
['commit', '-m', '"test: this should work"', '--signoff'],
303-
{cwd}
304-
);
305-
await execa('git', ['commit', '--amend', '--no-edit'], {cwd});
306-
});
279+
const cwd = await git.bootstrap('fixtures/signoff');
280+
await writePkg({husky: {hooks: {'commit-msg': `'${bin}' -e`}}}, {cwd});
281+
282+
await execa('npm', ['install'], {cwd});
283+
await execa('git', ['add', 'package.json'], {cwd});
284+
await execa(
285+
'git',
286+
['commit', '-m', '"test: this should work"', '--signoff'],
287+
{cwd}
288+
);
289+
await execa('git', ['commit', '--amend', '--no-edit'], {cwd});
307290
});
308291

309292
test('should handle linting with issue prefixes', async t => {

0 commit comments

Comments
 (0)