it('does not convert spec when string', () => { const options = { spec: 'x,y,z', } snapshot('spec_as_string', normalizeModuleOptions(options)) })
it('does not change other properties', () => { const options = { foo: 'bar', } snapshot('others_unchanged', normalizeModuleOptions(options)) })
it('passes string env unchanged', () => { const options = { env: 'foo=bar', } snapshot('env_as_string', normalizeModuleOptions(options)) })
it('handles several tags', function () { const releases = { name: 'ci-publish', versions: ['1.0.0', '1.0.1', '1.0.2', '1.0.3', '1.0.4', '1.1.0'], timestamps: [ '2016-01-07T20:49:10.977Z', '2016-01-07T20:54:08.557Z', '2016-01-07T20:59:05.577Z', '2016-01-07T21:15:00.188Z', '2016-01-07T21:15:40.930Z', '2016-01-08T03:27:18.522Z' ], 'dist-tags': { latest: '1.1.0', dev: '1.1.0', old: '1.0.0' } } const options = { now: moment('2018-06-01') } const human = toHuman(releases, options) la(human.length === releases.versions.length, 'wrong number of versions') checkOutput(human) snapshot(human) })
it('does not remove --record option when using --browser', () => { const args = run.processRunOptions({ record: 'foo', browser: 'test browser', }) snapshot(args) })
.then(() => { expect(download.start).not.to.be.called snapshot( 'skip installation', normalize(this.stdout.toString()) ) })
it('simple-icons javascript logo default color (#F7DF1E)', function() { const svg = makeBadge({ text: ['label', 'message'], format: 'svg', logo: 'javascript', }) snapshot(svg) })
it('logs noop message', function () { expect(download.start).not.to.be.called snapshot( 'version already installed', normalize(this.stdout.toString()) ) })
it('shields GitHub logo default color (#333333)', function() { const svg = makeBadge({ text: ['label', 'message'], format: 'svg', logo: 'github', }) snapshot(svg) })
it('simple-icons javascript logo custom color (rgba(46,204,113,0.8))', function() { const svg = makeBadge({ text: ['label', 'message'], format: 'svg', logo: 'javascript', logoColor: 'rgba(46,204,113,0.8)', }) snapshot(svg) })
it('shields GitHub logo custom color (whitesmoke)', function() { const svg = makeBadge({ text: ['label', 'message'], format: 'svg', logo: 'github', logoColor: 'whitesmoke', }) snapshot(svg) })
it('converts reporterOptions object', () => { const options = { reporterOptions: { mochaFile: 'results/my-test-output.xml', toConsole: true, }, } snapshot('reporter_options_as_object', normalizeModuleOptions(options)) })
it('converts config object', () => { const options = { config: { baseUrl: 'http://localhost:2000', watchForFileChanges: false, }, } snapshot('config_as_object', normalizeModuleOptions(options)) })
it('converts specs array', () => { const options = { spec: [ 'a', 'b', 'c', ], } snapshot('spec_as_array', normalizeModuleOptions(options)) })
it('converts environment object', () => { const options = { env: { foo: 'bar', magicNumber: 1234, host: 'kevin.dev.local', }, } snapshot('env_as_object', normalizeModuleOptions(options)) })
it('gets main badges', () => { const options = { name: 'test-example', repoName: 'test-repo', username: '******', npmBadge: true, travisBadge: true, semanticReleaseBadge: true, standardBadge: true } const urls = getBadges(options) snapshot(urls) })
it('logs message and starts download', function () { expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) expect(unzip.start).to.be.calledWithMatch({ version: packageVersion, }) snapshot( 'continues installing on failure', normalize(this.stdout.toString()) ) })
it('can include renovate app', () => { const options = { name: 'test-example', repoName: 'test-repo', username: '******', npmBadge: true, travisBadge: true, semanticReleaseBadge: true, standardBadge: true, renovateBadge: true } const urls = getBadges(options) snapshot(urls) })
it('logs global warning and download', function () { expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) expect(unzip.start).to.be.calledWithMatch({ version: packageVersion, }) snapshot( 'warning installing as global', normalize(this.stdout.toString()) ) })
it('logs message and starts download', function () { expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) expect(unzip.start).to.be.calledWithMatch({ version: packageVersion, }) snapshot( 'installed version does not match needed version', normalize(this.stdout.toString()) ) })
.then(() => { expect(download.start).to.be.calledWithMatch({ version, }) expect(unzip.start).to.be.calledWithMatch({ version, }) snapshot( 'specify version in env vars', normalize(this.stdout.toString()) ) })
it('logs message and starts download', function () { expect(info.clearVersionState).to.be.called expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) expect(unzip.start).to.be.calledWithMatch({ version: packageVersion, }) snapshot( 'forcing true always installs', normalize(this.stdout.toString()) ) })
it('parses given output', () => { stubSpawnOnce( 'git log --pretty=full', 0, stripIndent` commit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Author: Gleb Bahmutov <*****@*****.**> Commit: Gleb Bahmutov <*****@*****.**> first commit commit bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb Author: Gleb Bahmutov <*****@*****.**> Commit: Gleb Bahmutov <*****@*****.**> second commit ` ) return snapshot(commits.all()) })
it('logs message and starts download', function () { expect(info.clearVersionState).to.be.called expect(download.start).to.be.calledWithMatch({ version: packageVersion, }) expect(unzip.start).to.be.calledWithMatch({ version: packageVersion, }) // cleans up the zip file expect(fs.removeAsync).to.be.calledWith( downloadDestination.filename ) snapshot( 'installs without existing installation', normalize(this.stdout.toString()) ) })
it('returns latest desktop url', () => { const url = download.getUrl() snapshot('latest desktop url', normalize(url)) })
.catch((err) => { logger.error(err) return snapshot('download status errors', normalize(ctx.stdout.toString())) })
it('should always produce the same SVG (unless we have changed something!)', function() { const svg = makeBadge({ text: ['cactus', 'grown'], format: 'svg' }) snapshot(svg) })
it('returns specific desktop version url', () => { const url = download.getUrl('0.20.2') snapshot('specific version desktop url', normalize(url)) })
it('env var with subdirectory', () => { process.env.CYPRESS_DOWNLOAD_MIRROR = 'https://cypress.example.com/example' const url = download.getUrl('0.20.2') snapshot('base url from CYPRESS_DOWNLOAD_MIRROR with subdirectory', normalize(url)) })
it('passes --record option', () => { const args = run.processRunOptions({ record: 'my record id', }) snapshot(args) })