Files
cypress/cli/test/lib/exec/versions_spec.js
Ben Kucera fbd523615e [internal] Lint typescript, json, new eslint rules (#4449)
* temp 07/01/19 [skip ci] main lint files

* use lint-staged scripts

* fix all auto-fixable eslint errors

* manually fix lint issues in files

* temp 07/01/19 [skip ci]

* bump eslint plugin versions, update circle.yml

* [lint fix] remaining js files

* update vscode/settings.json

* add back stop-only

* use stop-only for linting .onlys

* fix verify_spec, build_spec

* update json plugin

* relint & apply corrections

* fix appveyor.yml not cleansing env vars (very bad)

* dont echo commit message in appveyor script

* retry build &

* re-add & upgrade lint-staged

* update contributing docs

* only let stop-only catch staged changes
2019-07-12 13:59:44 -04:00

36 lines
1.2 KiB
JavaScript

require('../../spec_helper')
const util = require(`${lib}/util`)
const state = require(`${lib}/tasks/state`)
const versions = require(`${lib}/exec/versions`)
describe('lib/exec/versions', function () {
beforeEach(function () {
sinon.stub(state, 'getBinaryDir').returns('/cache/1.2.3/Cypress.app')
sinon.stub(state, 'getBinaryPkgVersionAsync').withArgs('/cache/1.2.3/Cypress.app').resolves('1.2.3')
sinon.stub(util, 'pkgVersion').returns('4.5.6')
})
describe('.getVersions', function () {
it('gets the correct binary and package version', function () {
return versions.getVersions().then(({ package, binary }) => {
expect(package).to.eql('4.5.6')
expect(binary).to.eql('1.2.3')
})
})
it('gets correct binary version if CYPRESS_RUN_BINARY', function () {
sinon.stub(state, 'parseRealPlatformBinaryFolderAsync').resolves('/my/cypress/path')
process.env.CYPRESS_RUN_BINARY = '/my/cypress/path'
state.getBinaryPkgVersionAsync
.withArgs('/my/cypress/path')
.resolves('7.8.9')
return versions.getVersions().then(({ package, binary }) => {
expect(package).to.eql('4.5.6')
expect(binary).to.eql('7.8.9')
})
})
})
})