mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-22 23:20:24 -05:00
cli: fix unit test for windows
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"bin-up": "^1.1.0",
|
||||
"chai": "^3.5.0",
|
||||
"chai-string": "1.4.0",
|
||||
"clear-module": "^2.1.0",
|
||||
"dependency-check": "^2.8.0",
|
||||
"execa-wrap": "1.1.0",
|
||||
|
||||
@@ -81,6 +81,13 @@ describe('info', function () {
|
||||
})
|
||||
})
|
||||
|
||||
context('.getPathToExecutable', function () {
|
||||
it('resolves path on windows', function () {
|
||||
this.sandbox.stub(os, 'platform').returns('win32')
|
||||
expect(info.getPathToExecutable()).to.endWith('.exe')
|
||||
})
|
||||
})
|
||||
|
||||
context('.getPathToUserExecutableDir', function () {
|
||||
it('resolves path on macOS', function () {
|
||||
this.sandbox.stub(os, 'platform').returns('darwin')
|
||||
@@ -92,9 +99,14 @@ describe('info', function () {
|
||||
expect(info.getPathToUserExecutableDir()).to.equal(path.join(installationDir, 'Cypress'))
|
||||
})
|
||||
|
||||
it('rejects on anything else', function () {
|
||||
it('resolves path on windows', function () {
|
||||
this.sandbox.stub(os, 'platform').returns('win32')
|
||||
expect(() => info.getPathToUserExecutableDir()).to.throw('Platform: "win32" is not supported.')
|
||||
expect(info.getPathToUserExecutableDir()).to.endWith('Cypress')
|
||||
})
|
||||
|
||||
it('rejects on anything else', function () {
|
||||
this.sandbox.stub(os, 'platform').returns('unknown')
|
||||
expect(() => info.getPathToUserExecutableDir()).to.throw('Platform: "unknown" is not supported.')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ global.lib = path.join(__dirname, '..', 'lib')
|
||||
|
||||
require('chai')
|
||||
.use(require('@cypress/sinon-chai'))
|
||||
.use(require('chai-string'))
|
||||
|
||||
beforeEach(function () {
|
||||
this.sandbox = sinon.sandbox.create().usingPromise(Promise)
|
||||
|
||||
Reference in New Issue
Block a user