Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test(prompt-cli): migrate ava tests to jest
  • Loading branch information
armano2 committed Jan 27, 2020
commit 1c0c35803fd149514d15a9919d58a3edb5e960ff
9 changes: 4 additions & 5 deletions @commitlint/prompt-cli/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import path from 'path';
import {git} from '@commitlint/test';
import test from 'ava';
import execa from 'execa';
import stream from 'string-to-stream';

const bin = path.join(__dirname, './cli.js');
const bin = require.resolve('./cli.js');

const cli = (args, options) => {
return (input = '') => {
Expand All @@ -18,8 +16,9 @@ const cli = (args, options) => {
};
};

test('should print warning if stage is empty', async t => {
test('should print warning if stage is empty', async () => {
const cwd = await git.bootstrap();
const actual = await cli([], {cwd})('foo: bar');
t.true(actual.stdout.includes('Nothing to commit.'));
expect(actual.stdout).toContain('Nothing to commit.');
expect(actual.stderr).toBe('');
});
8 changes: 3 additions & 5 deletions @commitlint/prompt-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"scripts": {
"commit": "$npm_package_bin_commit",
"deps": "dep-check",
"pkg": "pkg-check --skip-main",
"test": "ava -c 4 --verbose"
"pkg": "pkg-check --skip-main"
},
"repository": {
"type": "git",
Expand All @@ -31,11 +30,10 @@
"devDependencies": {
"@commitlint/test": "8.2.0",
"@commitlint/utils": "^8.3.4",
"ava": "2.4.0"
"string-to-stream": "3.0.1"
},
"dependencies": {
"@commitlint/prompt": "^8.3.5",
"execa": "0.11.0",
"string-to-stream": "3.0.1"
"execa": "0.11.0"
}
}
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
testMatch: [
'**/*.test.ts?(x)',
'**/@commitlint/read/src/*.test.js?(x)',
'**/@commitlint/cli/src/*.test.js?(x)'
'**/@commitlint/cli/src/*.test.js?(x)',
'**/@commitlint/prompt-cli/*.test.js?(x)'
]
};