release-it 19.0.0-next.1 → 19.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,10 @@
1
- import test from 'ava';
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
2
3
  import { getPluginName } from '../lib/plugin/factory.js';
3
4
 
4
- test('pluginName can return correct name for variants', t => {
5
- t.is(getPluginName('plain-plugin'), 'plain-plugin');
6
- t.is(getPluginName('@some/scoped-plugin'), '@some/scoped-plugin');
7
- t.is(getPluginName('@some/nested/scoped-plugin'), '@some/nested/scoped-plugin');
8
- t.is(getPluginName('./relative-plugin.cjs'), 'relative-plugin');
5
+ test('pluginName can return correct name for variants', async () => {
6
+ assert.equal(getPluginName('plain-plugin'), 'plain-plugin');
7
+ assert.equal(getPluginName('@some/scoped-plugin'), '@some/scoped-plugin');
8
+ assert.equal(getPluginName('@some/nested/scoped-plugin'), '@some/nested/scoped-plugin');
9
+ assert.equal(getPluginName('./relative-plugin.cjs'), 'relative-plugin');
9
10
  });
package/test/plugins.js CHANGED
@@ -1,243 +1,232 @@
1
1
  import { resolve, join } from 'node:path';
2
2
  import childProcess from 'node:child_process';
3
3
  import fs, { appendFileSync, mkdirSync } from 'node:fs';
4
- import test from 'ava';
5
- import sinon from 'sinon';
6
- import Log from '../lib/log.js';
7
- import Spinner from '../lib/spinner.js';
4
+ import test, { afterEach, describe } from 'node:test';
5
+ import assert from 'node:assert/strict';
8
6
  import Config from '../lib/config.js';
9
7
  import { execOpts, parseGitUrl } from '../lib/util.js';
10
8
  import runTasks from '../lib/index.js';
11
9
  import MyPlugin from './stub/plugin.js';
12
10
  import ReplacePlugin from './stub/plugin-replace.js';
13
11
  import ContextPlugin from './stub/plugin-context.js';
14
- import { mkTmpDir } from './util/helpers.js';
12
+ import { getArgs, mkTmpDir } from './util/helpers.js';
15
13
  import ShellStub from './stub/shell.js';
14
+ import { LogStub, SpinnerStub } from './util/index.js';
16
15
 
17
- const noop = Promise.resolve();
18
-
19
- const sandbox = sinon.createSandbox();
20
-
21
- const testConfig = {
22
- ci: true,
23
- config: false
24
- };
16
+ describe('plugins', () => {
17
+ const testConfig = {
18
+ ci: true,
19
+ config: false
20
+ };
25
21
 
26
- const log = sandbox.createStubInstance(Log);
27
- const spinner = sandbox.createStubInstance(Spinner);
28
- spinner.show.callsFake(({ enabled = true, task }) => (enabled ? task() : noop));
22
+ const log = new LogStub();
23
+ const spinner = new SpinnerStub();
29
24
 
30
- const getContainer = options => {
31
- const config = new Config(Object.assign({}, testConfig, options));
32
- const shell = new ShellStub({ container: { log, config } });
33
- return {
34
- log,
35
- spinner,
36
- config,
37
- shell
25
+ const getContainer = options => {
26
+ const config = new Config(Object.assign({}, testConfig, options));
27
+ const shell = new ShellStub({ container: { log, config } });
28
+ return { log, spinner, config, shell };
38
29
  };
39
- };
40
30
 
41
- test.before(t => {
42
- t.timeout(60 * 1000);
43
31
  childProcess.execSync('npm link', execOpts);
44
- });
45
32
 
46
- test.serial.beforeEach(t => {
47
- const dir = mkTmpDir();
48
- process.chdir(dir);
49
- t.context = { dir };
50
- });
51
-
52
- test.serial.afterEach(() => {
53
- sandbox.resetHistory();
54
- });
33
+ afterEach(() => {
34
+ log.resetCalls();
35
+ });
55
36
 
56
- test.serial('should instantiate plugins and execute all release-cycle methods', async t => {
57
- const { dir } = t.context;
58
-
59
- const pluginDir = mkTmpDir();
60
- process.chdir(pluginDir);
61
-
62
- appendFileSync(
63
- join(pluginDir, 'package.json'),
64
- JSON.stringify({ name: 'my-plugin', version: '1.0.0', type: 'module' })
65
- );
66
- childProcess.execSync(`npm link release-it`, execOpts);
67
- const content = "import { Plugin } from 'release-it'; " + MyPlugin.toString() + '; export default MyPlugin;';
68
-
69
- appendFileSync(join(pluginDir, 'index.js'), content);
70
- process.chdir(dir);
71
- mkdirSync(resolve('my/plugin'), { recursive: true });
72
- process.chdir('my/plugin');
73
-
74
- appendFileSync(join(dir, 'my', 'plugin', 'index.js'), content);
75
- process.chdir(dir);
76
-
77
- appendFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0', type: 'module' }));
78
- childProcess.execSync(`npm install ${pluginDir}`, execOpts);
79
- childProcess.execSync(`npm link release-it`, execOpts);
80
-
81
- const config = {
82
- plugins: {
83
- 'my-plugin': {
84
- name: 'foo'
85
- },
86
- './my/plugin/index.js': [
87
- 'named-plugin',
88
- {
89
- name: 'bar'
90
- }
37
+ test('should instantiate plugins and execute all release-cycle methods', async () => {
38
+ const pluginDir = mkTmpDir();
39
+ const dir = mkTmpDir();
40
+ process.chdir(pluginDir);
41
+
42
+ appendFileSync(
43
+ join(pluginDir, 'package.json'),
44
+ JSON.stringify({ name: 'my-plugin', version: '1.0.0', type: 'module' })
45
+ );
46
+ childProcess.execSync(`npm link release-it`, execOpts);
47
+ const content = "import { Plugin } from 'release-it'; " + MyPlugin.toString() + '; export default MyPlugin;';
48
+
49
+ appendFileSync(join(pluginDir, 'index.js'), content);
50
+ process.chdir(dir);
51
+ mkdirSync(resolve('my/plugin'), { recursive: true });
52
+ process.chdir('my/plugin');
53
+
54
+ appendFileSync(join(dir, 'my', 'plugin', 'index.js'), content);
55
+ process.chdir(dir);
56
+
57
+ appendFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0', type: 'module' }));
58
+ childProcess.execSync(`npm install ${pluginDir}`, execOpts);
59
+ childProcess.execSync(`npm link release-it`, execOpts);
60
+
61
+ const config = {
62
+ plugins: {
63
+ 'my-plugin': {
64
+ name: 'foo'
65
+ },
66
+ './my/plugin/index.js': [
67
+ 'named-plugin',
68
+ {
69
+ name: 'bar'
70
+ }
71
+ ]
72
+ }
73
+ };
74
+ const container = getContainer(config);
75
+
76
+ const result = await runTasks({}, container);
77
+
78
+ assert.deepEqual(
79
+ container.log.info.mock.calls.map(call => call.arguments),
80
+ [
81
+ ['my-plugin:foo:init'],
82
+ ['named-plugin:bar:init'],
83
+ ['my-plugin:foo:getName'],
84
+ ['my-plugin:foo:getLatestVersion'],
85
+ ['my-plugin:foo:getIncrement'],
86
+ ['my-plugin:foo:getIncrementedVersionCI'],
87
+ ['named-plugin:bar:getIncrementedVersionCI'],
88
+ ['my-plugin:foo:beforeBump'],
89
+ ['named-plugin:bar:beforeBump'],
90
+ ['my-plugin:foo:bump:1.3.0'],
91
+ ['named-plugin:bar:bump:1.3.0'],
92
+ ['my-plugin:foo:beforeRelease'],
93
+ ['named-plugin:bar:beforeRelease'],
94
+ ['my-plugin:foo:release'],
95
+ ['named-plugin:bar:release'],
96
+ ['my-plugin:foo:afterRelease'],
97
+ ['named-plugin:bar:afterRelease']
91
98
  ]
92
- }
93
- };
94
- const container = getContainer(config);
95
-
96
- const result = await runTasks({}, container);
97
-
98
- t.deepEqual(container.log.info.args, [
99
- ['my-plugin:foo:init'],
100
- ['named-plugin:bar:init'],
101
- ['my-plugin:foo:getName'],
102
- ['my-plugin:foo:getLatestVersion'],
103
- ['my-plugin:foo:getIncrement'],
104
- ['my-plugin:foo:getIncrementedVersionCI'],
105
- ['named-plugin:bar:getIncrementedVersionCI'],
106
- ['my-plugin:foo:beforeBump'],
107
- ['named-plugin:bar:beforeBump'],
108
- ['my-plugin:foo:bump:1.3.0'],
109
- ['named-plugin:bar:bump:1.3.0'],
110
- ['my-plugin:foo:beforeRelease'],
111
- ['named-plugin:bar:beforeRelease'],
112
- ['my-plugin:foo:release'],
113
- ['named-plugin:bar:release'],
114
- ['my-plugin:foo:afterRelease'],
115
- ['named-plugin:bar:afterRelease']
116
- ]);
117
-
118
- t.deepEqual(result, {
119
- changelog: undefined,
120
- name: 'new-project-name',
121
- latestVersion: '1.2.3',
122
- version: '1.3.0'
99
+ );
100
+
101
+ assert.deepEqual(result, {
102
+ changelog: undefined,
103
+ name: 'new-project-name',
104
+ latestVersion: '1.2.3',
105
+ version: '1.3.0'
106
+ });
123
107
  });
124
- });
125
-
126
- test.serial('should instantiate plugins and execute all release-cycle methods for scoped plugins', async t => {
127
- const { dir } = t.context;
128
-
129
- const pluginDir = mkTmpDir();
130
- process.chdir(pluginDir);
131
-
132
- fs.writeFileSync(
133
- join(pluginDir, 'package.json'),
134
- JSON.stringify({ name: '@scoped/my-plugin', version: '1.0.0', type: 'module' })
135
- );
136
- childProcess.execSync(`npm link release-it`, execOpts);
137
- const content = "import { Plugin } from 'release-it'; " + MyPlugin.toString() + '; export default MyPlugin;';
138
-
139
- fs.writeFileSync(join(pluginDir, 'index.js'), content);
140
- process.chdir(dir);
141
-
142
- fs.writeFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0', type: 'module' }));
143
- childProcess.execSync(`npm install ${pluginDir}`, execOpts);
144
- childProcess.execSync(`npm link release-it`, execOpts);
145
108
 
146
- const config = {
147
- plugins: {
148
- '@scoped/my-plugin': {
149
- name: 'foo'
109
+ test('should instantiate plugins and execute all release-cycle methods for scoped plugins', async () => {
110
+ const pluginDir = mkTmpDir();
111
+ const dir = mkTmpDir();
112
+ process.chdir(pluginDir);
113
+
114
+ fs.writeFileSync(
115
+ join(pluginDir, 'package.json'),
116
+ JSON.stringify({ name: '@scoped/my-plugin', version: '1.0.0', type: 'module' })
117
+ );
118
+ childProcess.execSync(`npm link release-it`, execOpts);
119
+ const content = "import { Plugin } from 'release-it'; " + MyPlugin.toString() + '; export default MyPlugin;';
120
+
121
+ fs.writeFileSync(join(pluginDir, 'index.js'), content);
122
+ process.chdir(dir);
123
+
124
+ fs.writeFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0', type: 'module' }));
125
+ childProcess.execSync(`npm install ${pluginDir}`, execOpts);
126
+ childProcess.execSync(`npm link release-it`, execOpts);
127
+
128
+ const config = {
129
+ plugins: {
130
+ '@scoped/my-plugin': {
131
+ name: 'foo'
132
+ }
150
133
  }
151
- }
152
- };
153
- const container = getContainer(config);
154
-
155
- const result = await runTasks({}, container);
156
-
157
- t.deepEqual(container.log.info.args, [
158
- ['@scoped/my-plugin:foo:init'],
159
- ['@scoped/my-plugin:foo:getName'],
160
- ['@scoped/my-plugin:foo:getLatestVersion'],
161
- ['@scoped/my-plugin:foo:getIncrement'],
162
- ['@scoped/my-plugin:foo:getIncrementedVersionCI'],
163
- ['@scoped/my-plugin:foo:beforeBump'],
164
- ['@scoped/my-plugin:foo:bump:1.3.0'],
165
- ['@scoped/my-plugin:foo:beforeRelease'],
166
- ['@scoped/my-plugin:foo:release'],
167
- ['@scoped/my-plugin:foo:afterRelease']
168
- ]);
169
-
170
- t.deepEqual(result, {
171
- changelog: undefined,
172
- name: 'new-project-name',
173
- latestVersion: '1.2.3',
174
- version: '1.3.0'
134
+ };
135
+ const container = getContainer(config);
136
+
137
+ const result = await runTasks({}, container);
138
+
139
+ assert.deepEqual(
140
+ container.log.info.mock.calls.map(call => call.arguments),
141
+ [
142
+ ['@scoped/my-plugin:foo:init'],
143
+ ['@scoped/my-plugin:foo:getName'],
144
+ ['@scoped/my-plugin:foo:getLatestVersion'],
145
+ ['@scoped/my-plugin:foo:getIncrement'],
146
+ ['@scoped/my-plugin:foo:getIncrementedVersionCI'],
147
+ ['@scoped/my-plugin:foo:beforeBump'],
148
+ ['@scoped/my-plugin:foo:bump:1.3.0'],
149
+ ['@scoped/my-plugin:foo:beforeRelease'],
150
+ ['@scoped/my-plugin:foo:release'],
151
+ ['@scoped/my-plugin:foo:afterRelease']
152
+ ]
153
+ );
154
+
155
+ assert.deepEqual(result, {
156
+ changelog: undefined,
157
+ name: 'new-project-name',
158
+ latestVersion: '1.2.3',
159
+ version: '1.3.0'
160
+ });
175
161
  });
176
- });
177
162
 
178
- test.serial('should disable core plugins', async t => {
179
- const { dir } = t.context;
163
+ test('should disable core plugins', async () => {
164
+ const dir = mkTmpDir();
165
+ process.chdir(dir);
180
166
 
181
- fs.appendFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0' }));
182
- const content =
183
- "import { Plugin } from 'release-it'; " + ReplacePlugin.toString() + '; export default ReplacePlugin;';
167
+ fs.appendFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'project', version: '1.0.0' }));
168
+ const content =
169
+ "import { Plugin } from 'release-it'; " + ReplacePlugin.toString() + '; export default ReplacePlugin;';
184
170
 
185
- fs.appendFileSync(join(dir, 'replace-plugin.mjs'), content);
186
- childProcess.execSync(`npm link release-it`, execOpts);
171
+ fs.appendFileSync(join(dir, 'replace-plugin.mjs'), content);
172
+ childProcess.execSync(`npm link release-it`, execOpts);
187
173
 
188
- const config = {
189
- plugins: {
190
- './replace-plugin.mjs': {}
191
- }
192
- };
193
- const container = getContainer(config);
174
+ const config = {
175
+ plugins: {
176
+ './replace-plugin.mjs': {}
177
+ }
178
+ };
179
+ const container = getContainer(config);
194
180
 
195
- const result = await runTasks({}, container);
181
+ const result = await runTasks({}, container);
196
182
 
197
- t.deepEqual(result, {
198
- changelog: undefined,
199
- name: undefined,
200
- latestVersion: '0.0.0',
201
- version: undefined
183
+ assert.deepEqual(result, {
184
+ changelog: undefined,
185
+ name: undefined,
186
+ latestVersion: '0.0.0',
187
+ version: undefined
188
+ });
202
189
  });
203
- });
204
-
205
- test.serial('should expose context to execute commands', async t => {
206
- const { dir } = t.context;
207
190
 
208
- fs.appendFileSync(join(dir, 'package.json'), JSON.stringify({ name: 'pkg-name', version: '1.0.0', type: 'module' }));
209
- const content =
210
- "import { Plugin } from 'release-it'; " + ContextPlugin.toString() + '; export default ContextPlugin;';
211
-
212
- fs.appendFileSync(join(dir, 'context-plugin.js'), content);
213
- childProcess.execSync(`npm link release-it`, execOpts);
214
-
215
- const repo = parseGitUrl('https://github.com/user/pkg');
216
-
217
- const container = getContainer({ plugins: { './context-plugin.js': {} } });
218
- const exec = sinon.spy(container.shell, 'execFormattedCommand');
219
-
220
- container.config.setContext({ repo });
221
- container.config.setContext({ tagName: '1.0.1' });
222
-
223
- await runTasks({}, container);
224
-
225
- const pluginExecArgs = exec.args
226
- .map(args => args[0])
227
- .filter(arg => typeof arg === 'string' && arg.startsWith('echo'));
228
-
229
- t.deepEqual(pluginExecArgs, [
230
- 'echo false',
231
- 'echo false',
232
- `echo pkg-name user 1.0.0 1.0.1`,
233
- `echo pkg-name user 1.0.0 1.0.1`,
234
- `echo user pkg user/pkg 1.0.1`,
235
- `echo user pkg user/pkg 1.0.1`,
236
- `echo user pkg user/pkg 1.0.1`,
237
- `echo user pkg user/pkg 1.0.1`,
238
- `echo pkg 1.0.0 1.0.1 1.0.1`,
239
- `echo pkg 1.0.0 1.0.1 1.0.1`,
240
- `echo pkg 1.0.0 1.0.1 1.0.1`,
241
- `echo pkg 1.0.0 1.0.1 1.0.1`
242
- ]);
191
+ test('should expose context to execute commands', async t => {
192
+ const dir = mkTmpDir();
193
+ process.chdir(dir);
194
+
195
+ fs.appendFileSync(
196
+ join(dir, 'package.json'),
197
+ JSON.stringify({ name: 'pkg-name', version: '1.0.0', type: 'module' })
198
+ );
199
+ const content =
200
+ "import { Plugin } from 'release-it'; " + ContextPlugin.toString() + '; export default ContextPlugin;';
201
+
202
+ fs.appendFileSync(join(dir, 'context-plugin.js'), content);
203
+ childProcess.execSync(`npm link release-it`, execOpts);
204
+
205
+ const repo = parseGitUrl('https://github.com/user/pkg');
206
+
207
+ const container = getContainer({ plugins: { './context-plugin.js': {} } });
208
+ const exec = t.mock.method(container.shell, 'execFormattedCommand');
209
+
210
+ container.config.setContext({ repo });
211
+ container.config.setContext({ tagName: '1.0.1' });
212
+
213
+ await runTasks({}, container);
214
+
215
+ const pluginExecArgs = getArgs(exec, 'echo');
216
+
217
+ assert.deepEqual(pluginExecArgs, [
218
+ 'echo false',
219
+ 'echo false',
220
+ `echo pkg-name user 1.0.0 1.0.1`,
221
+ `echo pkg-name user 1.0.0 1.0.1`,
222
+ `echo user pkg user/pkg 1.0.1`,
223
+ `echo user pkg user/pkg 1.0.1`,
224
+ `echo user pkg user/pkg 1.0.1`,
225
+ `echo user pkg user/pkg 1.0.1`,
226
+ `echo pkg 1.0.0 1.0.1 1.0.1`,
227
+ `echo pkg 1.0.0 1.0.1 1.0.1`,
228
+ `echo pkg 1.0.0 1.0.1 1.0.1`,
229
+ `echo pkg 1.0.0 1.0.1 1.0.1`
230
+ ]);
231
+ });
243
232
  });
package/test/prompt.js CHANGED
@@ -1,5 +1,5 @@
1
- import test from 'ava';
2
- import sinon from 'sinon';
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
3
  import Prompt from '../lib/prompt.js';
4
4
  import Config from '../lib/config.js';
5
5
  import git from '../lib/plugin/git/prompts.js';
@@ -13,31 +13,25 @@ const prompts = { git, github, gitlab, npm };
13
13
  const yes = ([options]) => Promise.resolve({ [options.name]: true });
14
14
  const no = ([options]) => Promise.resolve({ [options.name]: false });
15
15
 
16
- test.beforeEach(t => {
17
- t.context.getInquirer = stub => ({
18
- prompt: stub
19
- });
20
- });
21
-
22
16
  test('should not create prompt if disabled', async t => {
23
- const task = sinon.spy();
24
- const stub = sinon.stub().callsFake(yes);
25
- const inquirer = t.context.getInquirer(stub);
17
+ const task = t.mock.fn();
18
+ const promptMock = t.mock.fn(yes);
19
+ const inquirer = { prompt: promptMock };
26
20
  const prompt = factory(Prompt, { container: { inquirer } });
27
21
  prompt.register(prompts.git);
28
22
  await prompt.show({ enabled: false, prompt: 'push', task });
29
- t.is(stub.callCount, 0);
30
- t.is(task.callCount, 0);
23
+ assert.equal(promptMock.mock.callCount(), 0);
24
+ assert.equal(task.mock.callCount(), 0);
31
25
  });
32
26
 
33
27
  test('should create prompt', async t => {
34
- const stub = sinon.stub().callsFake(yes);
35
- const inquirer = t.context.getInquirer(stub);
28
+ const promptMock = t.mock.fn(yes);
29
+ const inquirer = { prompt: promptMock };
36
30
  const prompt = factory(Prompt, { container: { inquirer } });
37
31
  prompt.register(prompts.git);
38
32
  await prompt.show({ prompt: 'push' });
39
- t.is(stub.callCount, 1);
40
- t.deepEqual(stub.firstCall.args[0][0], {
33
+ assert.equal(promptMock.mock.callCount(), 1);
34
+ assert.deepEqual(promptMock.mock.calls[0].arguments[0][0], {
41
35
  type: 'confirm',
42
36
  message: 'Push?',
43
37
  name: 'push',
@@ -57,41 +51,41 @@ test('should create prompt', async t => {
57
51
  ['npm', 'otp', 'Please enter OTP for npm:']
58
52
  ].map(async ([namespace, prompt, message]) => {
59
53
  test(`should create prompt and render template message (${namespace}.${prompt})`, async t => {
60
- const stub = sinon.stub().callsFake(yes);
54
+ const promptMock = t.mock.fn(yes);
61
55
  const config = new Config({
62
56
  isPreRelease: true,
63
57
  git: { tagName: 'v${version}' },
64
58
  npm: { name: 'my-pkg', tag: 'next' }
65
59
  });
66
60
  config.setContext({ version: '1.0.0', tagName: '1.0.0' });
67
- const inquirer = t.context.getInquirer(stub);
61
+ const inquirer = { prompt: promptMock };
68
62
  const p = factory(Prompt, { container: { inquirer } });
69
63
  p.register(prompts[namespace], namespace);
70
64
  await p.show({ namespace, prompt, context: config.getContext() });
71
- t.is(stub.callCount, 1);
72
- t.is(stub.firstCall.args[0][0].message, message);
65
+ assert.equal(promptMock.mock.callCount(), 1);
66
+ assert.equal(promptMock.mock.calls[0].arguments[0][0].message, message);
73
67
  });
74
68
  });
75
69
 
76
70
  test('should execute task after positive answer', async t => {
77
- const task = sinon.spy();
78
- const stub = sinon.stub().callsFake(yes);
79
- const inquirer = t.context.getInquirer(stub);
71
+ const task = t.mock.fn();
72
+ const promptMock = t.mock.fn(yes);
73
+ const inquirer = { prompt: promptMock };
80
74
  const prompt = factory(Prompt, { container: { inquirer } });
81
75
  prompt.register(prompts.git);
82
76
  await prompt.show({ prompt: 'push', task });
83
- t.is(stub.callCount, 1);
84
- t.is(task.callCount, 1);
85
- t.is(task.firstCall.args[0], true);
77
+ assert.equal(promptMock.mock.callCount(), 1);
78
+ assert.equal(task.mock.callCount(), 1);
79
+ assert.equal(task.mock.calls[0].arguments[0], true);
86
80
  });
87
81
 
88
82
  test('should not execute task after negative answer', async t => {
89
- const task = sinon.spy();
90
- const stub = sinon.stub().callsFake(no);
91
- const inquirer = t.context.getInquirer(stub);
83
+ const task = t.mock.fn();
84
+ const promptMock = t.mock.fn(no);
85
+ const inquirer = { prompt: promptMock };
92
86
  const prompt = factory(Prompt, { container: { inquirer } });
93
87
  prompt.register(prompts.git);
94
88
  await prompt.show({ prompt: 'push', task });
95
- t.is(stub.callCount, 1);
96
- t.is(task.callCount, 0);
89
+ assert.equal(promptMock.mock.callCount(), 1);
90
+ assert.equal(task.mock.callCount(), 0);
97
91
  });