chore(package): update ava to version 1.0.1
This commit is contained in:
		
							parent
							
								
									5d6fd7c1cd
								
							
						
					
					
						commit
						ba00e16f43
					
				| @ -49,7 +49,7 @@ | |||||||
|     "yargs": "^12.0.0" |     "yargs": "^12.0.0" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "ava": "^0.25.0", |     "ava": "^1.0.1", | ||||||
|     "clear-module": "^3.0.0", |     "clear-module": "^3.0.0", | ||||||
|     "codecov": "^3.0.0", |     "codecov": "^3.0.0", | ||||||
|     "commitizen": "^3.0.0", |     "commitizen": "^3.0.0", | ||||||
|  | |||||||
| @ -146,7 +146,7 @@ test('Throw SemanticReleaseError for invalid configurations', async t => { | |||||||
|     {name: 'preview', prerelease: 'alpha', tags: []}, |     {name: 'preview', prerelease: 'alpha', tags: []}, | ||||||
|   ]; |   ]; | ||||||
|   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); |   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); | ||||||
|   const errors = [...(await t.throws(getBranches({options: {branches}})))]; |   const errors = [...(await t.throwsAsync(getBranches({options: {branches}})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'EMAINTENANCEBRANCH'); |   t.is(errors[0].code, 'EMAINTENANCEBRANCH'); | ||||||
| @ -174,7 +174,7 @@ test('Throw a SemanticReleaseError if there is duplicate branches', async t => { | |||||||
|   const branches = [{name: 'master', tags: []}, {name: 'master', tags: []}]; |   const branches = [{name: 'master', tags: []}, {name: 'master', tags: []}]; | ||||||
|   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); |   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(getBranches({options: {branches}})))]; |   const errors = [...(await t.throwsAsync(getBranches({options: {branches}})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'EDUPLICATEBRANCHES'); |   t.is(errors[0].code, 'EDUPLICATEBRANCHES'); | ||||||
| @ -186,7 +186,7 @@ test('Throw a SemanticReleaseError for each invalid branch name', async t => { | |||||||
|   const branches = [{name: '~master', tags: []}, {name: '^master', tags: []}]; |   const branches = [{name: '~master', tags: []}, {name: '^master', tags: []}]; | ||||||
|   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); |   const getBranches = proxyquire('../../lib/branches', {'./get-tags': () => branches, './expand': () => []}); | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(getBranches({options: {branches}})))]; |   const errors = [...(await t.throwsAsync(getBranches({options: {branches}})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'EINVALIDBRANCHNAME'); |   t.is(errors[0].code, 'EINVALIDBRANCHNAME'); | ||||||
|  | |||||||
| @ -511,7 +511,7 @@ test('Throw an Error if one of the shareable config cannot be found', async t => | |||||||
|   await outputJson(path.resolve(cwd, 'package.json'), {release: pkhOptions}); |   await outputJson(path.resolve(cwd, 'package.json'), {release: pkhOptions}); | ||||||
|   await outputJson(path.resolve(cwd, 'shareable1.json'), options1); |   await outputJson(path.resolve(cwd, 'shareable1.json'), options1); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(t.context.getConfig({cwd}), Error); |   const error = await t.throwsAsync(t.context.getConfig({cwd}), Error); | ||||||
| 
 | 
 | ||||||
|   t.is(error.message, "Cannot find module 'non-existing-path'"); |   t.is(error.message, "Cannot find module 'non-existing-path'"); | ||||||
|   t.is(error.code, 'MODULE_NOT_FOUND'); |   t.is(error.code, 'MODULE_NOT_FOUND'); | ||||||
|  | |||||||
| @ -44,7 +44,7 @@ test('Throw error if the last commit sha cannot be found', async t => { | |||||||
|   // Create a git repository, set the current working directory at the root of the repo
 |   // Create a git repository, set the current working directory at the root of the repo
 | ||||||
|   const {cwd} = await gitRepo(); |   const {cwd} = await gitRepo(); | ||||||
| 
 | 
 | ||||||
|   await t.throws(getGitHead({cwd}), Error); |   await t.throwsAsync(getGitHead({cwd}), Error); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test('Unshallow and fetch repository', async t => { | test('Unshallow and fetch repository', async t => { | ||||||
| @ -73,8 +73,8 @@ test('Do not throw error when unshallow a complete repository', async t => { | |||||||
|   await gitCommits(['Second'], {cwd}); |   await gitCommits(['Second'], {cwd}); | ||||||
|   await gitPush(repositoryUrl, 'second-branch', {cwd}); |   await gitPush(repositoryUrl, 'second-branch', {cwd}); | ||||||
| 
 | 
 | ||||||
|   await t.notThrows(fetch('master', {cwd})); |   await t.notThrowsAsync(fetch('master', {cwd})); | ||||||
|   await t.notThrows(fetch('second-branch', {cwd})); |   await t.notThrowsAsync(fetch('second-branch', {cwd})); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test('Fetch all tags on a detached head repository', async t => { | test('Fetch all tags on a detached head repository', async t => { | ||||||
| @ -108,7 +108,7 @@ test('Verify if the commit `sha` is in the direct history of the current branch' | |||||||
|   t.true(await isRefInHistory(commits[0].hash, 'master', false, {cwd})); |   t.true(await isRefInHistory(commits[0].hash, 'master', false, {cwd})); | ||||||
|   t.falsy(await isRefInHistory(otherCommits[0].hash, 'master', false, {cwd})); |   t.falsy(await isRefInHistory(otherCommits[0].hash, 'master', false, {cwd})); | ||||||
|   t.falsy(await isRefInHistory(otherCommits[0].hash, 'missing-branch', false, {cwd})); |   t.falsy(await isRefInHistory(otherCommits[0].hash, 'missing-branch', false, {cwd})); | ||||||
|   await t.throws(isRefInHistory('non-existant-sha', 'master', false, {cwd})); |   await t.throwsAsync(isRefInHistory('non-existant-sha', 'master', false, {cwd})); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test('Verify if a branch exists', async t => { | test('Verify if a branch exists', async t => { | ||||||
| @ -243,7 +243,7 @@ test('Return falsy for invalid tag names', async t => { | |||||||
| test('Throws error if obtaining the tags fails', async t => { | test('Throws error if obtaining the tags fails', async t => { | ||||||
|   const cwd = tempy.directory(); |   const cwd = tempy.directory(); | ||||||
| 
 | 
 | ||||||
|   await t.throws(getTags({cwd})); |   await t.throwsAsync(getTags({cwd})); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test('Return "true" if repository is up to date', async t => { | test('Return "true" if repository is up to date', async t => { | ||||||
|  | |||||||
| @ -763,7 +763,7 @@ test('Call all "success" plugins even if one errors out', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   await t.throws( |   await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
| @ -799,7 +799,7 @@ test('Log all "verifyConditions" errors', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const errors = [ |   const errors = [ | ||||||
|     ...(await t.throws( |     ...(await t.throwsAsync( | ||||||
|       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|     )), |     )), | ||||||
|   ]; |   ]; | ||||||
| @ -844,7 +844,7 @@ test('Log all "verifyRelease" errors', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const errors = [ |   const errors = [ | ||||||
|     ...(await t.throws( |     ...(await t.throwsAsync( | ||||||
|       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|     )), |     )), | ||||||
|   ]; |   ]; | ||||||
| @ -949,7 +949,7 @@ test('Dry-run skips fail', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const errors = [ |   const errors = [ | ||||||
|     ...(await t.throws( |     ...(await t.throwsAsync( | ||||||
|       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |       semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|     )), |     )), | ||||||
|   ]; |   ]; | ||||||
| @ -1268,7 +1268,7 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren | |||||||
|     'env-ci': () => ({isCi: true, branch: '1.x', isPr: false}), |     'env-ci': () => ({isCi: true, branch: '1.x', isPr: false}), | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws( |   const error = await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}) |     semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}) | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
| @ -1319,7 +1319,7 @@ test('Throws "EINVALIDNEXTVERSION" if next release is out of range of the curren | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws( |   const error = await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}) |     semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}) | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
| @ -1388,7 +1388,9 @@ test('Throws "EINVALIDMAINTENANCEMERGE" if merge an out of range release in a ma | |||||||
|     'env-ci': () => ({isCi: true, branch: '1.1.x', isPr: false}), |     'env-ci': () => ({isCi: true, branch: '1.1.x', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const errors = [ |   const errors = [ | ||||||
|     ...(await t.throws(semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}))), |     ...(await t.throwsAsync( | ||||||
|  |       semanticRelease(options, {cwd, env: {}, stdout: {write: () => {}}, stderr: {write: () => {}}}) | ||||||
|  |     )), | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   t.is(addChannel.callCount, 1); |   t.is(addChannel.callCount, 1); | ||||||
| @ -1587,7 +1589,7 @@ test('Log both plugins errors and errors thrown by "fail" plugin', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   await t.throws( |   await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
| @ -1612,7 +1614,7 @@ test('Call "fail" only if a plugin returns a SemanticReleaseError', async t => { | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   await t.throws( |   await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
| @ -1629,7 +1631,7 @@ test('Throw SemanticReleaseError if repositoryUrl is not set and cannot be found | |||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const errors = [ |   const errors = [ | ||||||
|     ...(await t.throws( |     ...(await t.throwsAsync( | ||||||
|       semanticRelease({}, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) |       semanticRelease({}, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}) | ||||||
|     )), |     )), | ||||||
|   ]; |   ]; | ||||||
| @ -1668,7 +1670,7 @@ test('Throw an Error if plugin returns an unexpected value', async t => { | |||||||
|     './lib/get-logger': () => t.context.logger, |     './lib/get-logger': () => t.context.logger, | ||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   const error = await t.throws( |   const error = await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}), |     semanticRelease(options, {cwd, env: {}, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}), | ||||||
|     Error |     Error | ||||||
|   ); |   ); | ||||||
| @ -1698,7 +1700,7 @@ test('Hide sensitive information passed to "fail" plugin', async t => { | |||||||
|     './lib/get-logger': () => t.context.logger, |     './lib/get-logger': () => t.context.logger, | ||||||
|     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), |     'env-ci': () => ({isCi: true, branch: 'master', isPr: false}), | ||||||
|   }); |   }); | ||||||
|   await t.throws( |   await t.throwsAsync( | ||||||
|     semanticRelease(options, {cwd, env, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}), |     semanticRelease(options, {cwd, env, stdout: new WritableStreamBuffer(), stderr: new WritableStreamBuffer()}), | ||||||
|     Error |     Error | ||||||
|   ); |   ); | ||||||
|  | |||||||
| @ -317,7 +317,7 @@ test('Exit with 1 if a plugin is not found', async t => { | |||||||
|     release: {analyzeCommits: 'non-existing-path', success: false, fail: false}, |     release: {analyzeCommits: 'non-existing-path', success: false, fail: false}, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const {code, stderr} = await t.throws(execa(cli, [], {env, cwd})); |   const {code, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd})); | ||||||
|   t.is(code, 1); |   t.is(code, 1); | ||||||
|   t.regex(stderr, /Cannot find module/); |   t.regex(stderr, /Cannot find module/); | ||||||
| }); | }); | ||||||
| @ -335,7 +335,7 @@ test('Exit with 1 if a shareable config is not found', async t => { | |||||||
|     release: {extends: 'non-existing-path', success: false, fail: false}, |     release: {extends: 'non-existing-path', success: false, fail: false}, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const {code, stderr} = await t.throws(execa(cli, [], {env, cwd})); |   const {code, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd})); | ||||||
|   t.is(code, 1); |   t.is(code, 1); | ||||||
|   t.regex(stderr, /Cannot find module/); |   t.regex(stderr, /Cannot find module/); | ||||||
| }); | }); | ||||||
| @ -356,7 +356,7 @@ test('Exit with 1 if a shareable config reference a not found plugin', async t = | |||||||
|   }); |   }); | ||||||
|   await writeJson(path.resolve(cwd, 'shareable.json'), shareable); |   await writeJson(path.resolve(cwd, 'shareable.json'), shareable); | ||||||
| 
 | 
 | ||||||
|   const {code, stderr} = await t.throws(execa(cli, [], {env, cwd})); |   const {code, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd})); | ||||||
|   t.is(code, 1); |   t.is(code, 1); | ||||||
|   t.regex(stderr, /Cannot find module/); |   t.regex(stderr, /Cannot find module/); | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -62,7 +62,7 @@ test('Wrap plugin in a function that add the "pluginName" to the error"', async | |||||||
|     './plugin-error': './test/fixtures', |     './plugin-error': './test/fixtures', | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(plugin({options: {}})); |   const error = await t.throwsAsync(plugin({options: {}})); | ||||||
| 
 | 
 | ||||||
|   t.is(error.pluginName, './plugin-error'); |   t.is(error.pluginName, './plugin-error'); | ||||||
| }); | }); | ||||||
| @ -72,7 +72,7 @@ test('Wrap plugin in a function that add the "pluginName" to multiple errors"', | |||||||
|     './plugin-errors': './test/fixtures', |     './plugin-errors': './test/fixtures', | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(plugin({options: {}})))]; |   const errors = [...(await t.throwsAsync(plugin({options: {}})))]; | ||||||
|   for (const error of errors) { |   for (const error of errors) { | ||||||
|     t.is(error.pluginName, './plugin-errors'); |     t.is(error.pluginName, './plugin-errors'); | ||||||
|   } |   } | ||||||
| @ -107,7 +107,7 @@ test('Wrap "analyzeCommits" plugin in a function that validate the output of the | |||||||
|     {} |     {} | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(plugin({options: {}})); |   const error = await t.throwsAsync(plugin({options: {}})); | ||||||
| 
 | 
 | ||||||
|   t.is(error.code, 'EANALYZECOMMITSOUTPUT'); |   t.is(error.code, 'EANALYZECOMMITSOUTPUT'); | ||||||
|   t.is(error.name, 'SemanticReleaseError'); |   t.is(error.name, 'SemanticReleaseError'); | ||||||
| @ -125,7 +125,7 @@ test('Wrap "generateNotes" plugin in a function that validate the output of the | |||||||
|     {} |     {} | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(plugin({options: {}})); |   const error = await t.throwsAsync(plugin({options: {}})); | ||||||
| 
 | 
 | ||||||
|   t.is(error.code, 'EGENERATENOTESOUTPUT'); |   t.is(error.code, 'EGENERATENOTESOUTPUT'); | ||||||
|   t.is(error.name, 'SemanticReleaseError'); |   t.is(error.name, 'SemanticReleaseError'); | ||||||
| @ -143,7 +143,7 @@ test('Wrap "publish" plugin in a function that validate the output of the plugin | |||||||
|     {} |     {} | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(plugin({options: {}})); |   const error = await t.throwsAsync(plugin({options: {}})); | ||||||
| 
 | 
 | ||||||
|   t.is(error.code, 'EPUBLISHOUTPUT'); |   t.is(error.code, 'EPUBLISHOUTPUT'); | ||||||
|   t.is(error.name, 'SemanticReleaseError'); |   t.is(error.name, 'SemanticReleaseError'); | ||||||
| @ -161,7 +161,7 @@ test('Wrap "addChannel" plugin in a function that validate the output of the plu | |||||||
|     {} |     {} | ||||||
|   ); |   ); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(plugin({options: {}})); |   const error = await t.throwsAsync(plugin({options: {}})); | ||||||
| 
 | 
 | ||||||
|   t.is(error.code, 'EADDCHANNELOUTPUT'); |   t.is(error.code, 'EADDCHANNELOUTPUT'); | ||||||
|   t.is(error.name, 'SemanticReleaseError'); |   t.is(error.name, 'SemanticReleaseError'); | ||||||
|  | |||||||
| @ -83,7 +83,7 @@ test('Stop execution and throw error if a step rejects', async t => { | |||||||
|   const step2 = stub().rejects(new Error('test error')); |   const step2 = stub().rejects(new Error('test error')); | ||||||
|   const step3 = stub().resolves(3); |   const step3 = stub().resolves(3); | ||||||
| 
 | 
 | ||||||
|   const error = await t.throws(pipeline([step1, step2, step3])(0), Error); |   const error = await t.throwsAsync(pipeline([step1, step2, step3])(0), Error); | ||||||
|   t.is(error.message, 'test error'); |   t.is(error.message, 'test error'); | ||||||
|   t.true(step1.calledWith(0)); |   t.true(step1.calledWith(0)); | ||||||
|   t.true(step2.calledWith(0)); |   t.true(step2.calledWith(0)); | ||||||
| @ -98,7 +98,7 @@ test('Throw all errors from the first step throwing an AggregateError', async t | |||||||
|   const step2 = stub().rejects(new AggregateError([error1, error2])); |   const step2 = stub().rejects(new AggregateError([error1, error2])); | ||||||
|   const step3 = stub().resolves(3); |   const step3 = stub().resolves(3); | ||||||
| 
 | 
 | ||||||
|   const errors = await t.throws(pipeline([step1, step2, step3])(0)); |   const errors = await t.throwsAsync(pipeline([step1, step2, step3])(0)); | ||||||
| 
 | 
 | ||||||
|   t.deepEqual([...errors], [error1, error2]); |   t.deepEqual([...errors], [error1, error2]); | ||||||
|   t.true(step1.calledWith(0)); |   t.true(step1.calledWith(0)); | ||||||
| @ -113,7 +113,7 @@ test('Execute all even if a Promise rejects', async t => { | |||||||
|   const step2 = stub().rejects(error1); |   const step2 = stub().rejects(error1); | ||||||
|   const step3 = stub().rejects(error2); |   const step3 = stub().rejects(error2); | ||||||
| 
 | 
 | ||||||
|   const errors = await t.throws(pipeline([step1, step2, step3], {settleAll: true})(0)); |   const errors = await t.throwsAsync(pipeline([step1, step2, step3], {settleAll: true})(0)); | ||||||
| 
 | 
 | ||||||
|   t.deepEqual([...errors], [error1, error2]); |   t.deepEqual([...errors], [error1, error2]); | ||||||
|   t.true(step1.calledWith(0)); |   t.true(step1.calledWith(0)); | ||||||
| @ -129,7 +129,7 @@ test('Throw all errors from all steps throwing an AggregateError', async t => { | |||||||
|   const step1 = stub().rejects(new AggregateError([error1, error2])); |   const step1 = stub().rejects(new AggregateError([error1, error2])); | ||||||
|   const step2 = stub().rejects(new AggregateError([error3, error4])); |   const step2 = stub().rejects(new AggregateError([error3, error4])); | ||||||
| 
 | 
 | ||||||
|   const errors = await t.throws(pipeline([step1, step2], {settleAll: true})(0)); |   const errors = await t.throwsAsync(pipeline([step1, step2], {settleAll: true})(0)); | ||||||
| 
 | 
 | ||||||
|   t.deepEqual([...errors], [error1, error2, error3, error4]); |   t.deepEqual([...errors], [error1, error2, error3, error4]); | ||||||
|   t.true(step1.calledWith(0)); |   t.true(step1.calledWith(0)); | ||||||
| @ -145,7 +145,7 @@ test('Execute each function in series passing a transformed input even if a step | |||||||
|   const step4 = stub().resolves(4); |   const step4 = stub().resolves(4); | ||||||
|   const getNextInput = (prevResult, result) => prevResult + result; |   const getNextInput = (prevResult, result) => prevResult + result; | ||||||
| 
 | 
 | ||||||
|   const errors = await t.throws(pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput})(0)); |   const errors = await t.throwsAsync(pipeline([step1, step2, step3, step4], {settleAll: true, getNextInput})(0)); | ||||||
| 
 | 
 | ||||||
|   t.deepEqual([...errors], [error2, error3]); |   t.deepEqual([...errors], [error2, error3]); | ||||||
|   t.true(step1.calledWith(0)); |   t.true(step1.calledWith(0)); | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ test('Throw a AggregateError', async t => { | |||||||
|   const {cwd} = await gitRepo(); |   const {cwd} = await gitRepo(); | ||||||
|   const options = {branches: [{name: 'master'}, {name: ''}]}; |   const options = {branches: [{name: 'master'}, {name: ''}]}; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'ENOREPOURL'); |   t.is(errors[0].code, 'ENOREPOURL'); | ||||||
| @ -31,7 +31,7 @@ test('Throw a SemanticReleaseError if does not run on a git repository', async t | |||||||
|   const cwd = tempy.directory(); |   const cwd = tempy.directory(); | ||||||
|   const options = {branches: []}; |   const options = {branches: []}; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'ENOGITREPO'); |   t.is(errors[0].code, 'ENOGITREPO'); | ||||||
| @ -43,7 +43,7 @@ test('Throw a SemanticReleaseError if the "tagFormat" is not valid', async t => | |||||||
|   const {cwd, repositoryUrl} = await gitRepo(true); |   const {cwd, repositoryUrl} = await gitRepo(true); | ||||||
|   const options = {repositoryUrl, tagFormat: `?\${version}`, branches: []}; |   const options = {repositoryUrl, tagFormat: `?\${version}`, branches: []}; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'EINVALIDTAGFORMAT'); |   t.is(errors[0].code, 'EINVALIDTAGFORMAT'); | ||||||
| @ -55,7 +55,7 @@ test('Throw a SemanticReleaseError if the "tagFormat" does not contains the "ver | |||||||
|   const {cwd, repositoryUrl} = await gitRepo(true); |   const {cwd, repositoryUrl} = await gitRepo(true); | ||||||
|   const options = {repositoryUrl, tagFormat: 'test', branches: []}; |   const options = {repositoryUrl, tagFormat: 'test', branches: []}; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'ETAGNOVERSION'); |   t.is(errors[0].code, 'ETAGNOVERSION'); | ||||||
| @ -67,7 +67,7 @@ test('Throw a SemanticReleaseError if the "tagFormat" contains multiple "version | |||||||
|   const {cwd, repositoryUrl} = await gitRepo(true); |   const {cwd, repositoryUrl} = await gitRepo(true); | ||||||
|   const options = {repositoryUrl, tagFormat: `\${version}v\${version}`, branches: []}; |   const options = {repositoryUrl, tagFormat: `\${version}v\${version}`, branches: []}; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'ETAGNOVERSION'); |   t.is(errors[0].code, 'ETAGNOVERSION'); | ||||||
| @ -83,7 +83,7 @@ test('Throw a SemanticReleaseError for each invalid branch', async t => { | |||||||
|     branches: [{name: ''}, {name: '  '}, {name: 1}, {}, {name: ''}, 1, 'master'], |     branches: [{name: ''}, {name: '  '}, {name: 1}, {}, {name: ''}, 1, 'master'], | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   const errors = [...(await t.throws(verify({cwd, options})))]; |   const errors = [...(await t.throwsAsync(verify({cwd, options})))]; | ||||||
| 
 | 
 | ||||||
|   t.is(errors[0].name, 'SemanticReleaseError'); |   t.is(errors[0].name, 'SemanticReleaseError'); | ||||||
|   t.is(errors[0].code, 'EINVALIDBRANCH'); |   t.is(errors[0].code, 'EINVALIDBRANCH'); | ||||||
| @ -113,5 +113,5 @@ test('Return "true" if all verification pass', async t => { | |||||||
|   const {cwd, repositoryUrl} = await gitRepo(true); |   const {cwd, repositoryUrl} = await gitRepo(true); | ||||||
|   const options = {repositoryUrl, tagFormat: `v\${version}`, branches: [{name: 'master'}]}; |   const options = {repositoryUrl, tagFormat: `v\${version}`, branches: [{name: 'master'}]}; | ||||||
| 
 | 
 | ||||||
|   await t.notThrows(verify({cwd, options})); |   await t.notThrowsAsync(verify({cwd, options})); | ||||||
| }); | }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user