Skip to content

Commit ddb5670

Browse files
armano2byCedric
authored andcommitted
test(prompt-cli): migrate ava tests to jest (#913)
1 parent b512ac7 commit ddb5670

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

Diff for: @commitlint/prompt-cli/cli.test.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import path from 'path';
21
import {git} from '@commitlint/test';
3-
import test from 'ava';
42
import execa from 'execa';
53
import stream from 'string-to-stream';
64

7-
const bin = path.join(__dirname, './cli.js');
5+
const bin = require.resolve('./cli.js');
86

97
const cli = (args, options) => {
108
return (input = '') => {
@@ -18,8 +16,9 @@ const cli = (args, options) => {
1816
};
1917
};
2018

21-
test('should print warning if stage is empty', async t => {
19+
test('should print warning if stage is empty', async () => {
2220
const cwd = await git.bootstrap();
2321
const actual = await cli([], {cwd})('foo: bar');
24-
t.true(actual.stdout.includes('Nothing to commit.'));
22+
expect(actual.stdout).toContain('Nothing to commit.');
23+
expect(actual.stderr).toBe('');
2524
});

Diff for: @commitlint/prompt-cli/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"scripts": {
1212
"commit": "$npm_package_bin_commit",
1313
"deps": "dep-check",
14-
"pkg": "pkg-check --skip-main",
15-
"test": "ava -c 4 --verbose"
14+
"pkg": "pkg-check --skip-main"
1615
},
1716
"repository": {
1817
"type": "git",
@@ -31,11 +30,10 @@
3130
"devDependencies": {
3231
"@commitlint/test": "8.2.0",
3332
"@commitlint/utils": "^8.3.4",
34-
"ava": "2.4.0"
33+
"string-to-stream": "3.0.1"
3534
},
3635
"dependencies": {
3736
"@commitlint/prompt": "^8.3.5",
38-
"execa": "0.11.0",
39-
"string-to-stream": "3.0.1"
37+
"execa": "0.11.0"
4038
}
4139
}

Diff for: jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
testMatch: [
66
'**/*.test.ts?(x)',
77
'**/@commitlint/read/src/*.test.js?(x)',
8-
'**/@commitlint/cli/src/*.test.js?(x)'
8+
'**/@commitlint/cli/src/*.test.js?(x)',
9+
'**/@commitlint/prompt-cli/*.test.js?(x)'
910
]
1011
};

0 commit comments

Comments
 (0)