mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-19 21:51:16 -06:00
* try installing on Windows * Handle windows setup - no browser detection on windows yet, just placeholder code - symlink types * add appveyor file * add appveyor windows build * use execa to run server unit tests * run server unit tests on appveyor * ignore root install errors * upgrade rebuild-node-sass and work on Json unit test that fails on Windows * print npm version before installing, commented out caching node modules in the root * a few small tweaks for windows support * fix bin-up in launcher project use bin-up@1.1.0 for windows support, close #491 * cli: build script on Windows, close #492 * cli: build errors are fatal * use cross-env in extension Fixes environment variables on Windows in #490 * extension: fix 3 tests on Windows 1 more broken test remaining * extension: use EOL before comparing text * example: update test for Windows * example: replace build.sh with build.js Close #488 * remove trailing whitespace * cli: build script again * server: work on unit tests for windows * binary: add windows as build platform * windows: try building binary started work on building on CI for windows
70 lines
1.5 KiB
CoffeeScript
70 lines
1.5 KiB
CoffeeScript
fs = require("fs-extra")
|
|
path = require("path")
|
|
ospath = require("ospath")
|
|
Promise = require("bluebird")
|
|
la = require("lazy-ass")
|
|
check = require("check-more-types")
|
|
log = require("debug")("cypress:server:appdata")
|
|
pkg = require("@packages/root")
|
|
cwd = require("../cwd")
|
|
os = require("os")
|
|
|
|
fs = Promise.promisifyAll(fs)
|
|
name = pkg.productName or pkg.name
|
|
data = ospath.data()
|
|
|
|
if not name
|
|
throw new Error("Root package is missing name")
|
|
|
|
getSymlinkType = ->
|
|
if os.platform() == "win32"
|
|
"junction"
|
|
else
|
|
"dir"
|
|
|
|
isProduction = ->
|
|
process.env.CYPRESS_ENV is "production"
|
|
|
|
module.exports = {
|
|
ensure: ->
|
|
ensure = =>
|
|
@removeSymlink()
|
|
.then =>
|
|
Promise.join(
|
|
fs.ensureDirAsync(@path())
|
|
@symlink() unless isProduction()
|
|
)
|
|
|
|
## try twice to ensure the dir
|
|
ensure()
|
|
.catch(ensure)
|
|
|
|
symlink: ->
|
|
src = path.dirname(@path())
|
|
dest = cwd(".cy")
|
|
|
|
log("symlink folder from %s to %s", src, dest)
|
|
symlinkType = getSymlinkType()
|
|
fs.ensureSymlinkAsync(src, dest, symlinkType)
|
|
|
|
removeSymlink: ->
|
|
fs.removeAsync(cwd(".cy")).catch(->)
|
|
|
|
path: (paths...) ->
|
|
la(check.unemptyString(process.env.CYPRESS_ENV),
|
|
"expected CYPRESS_ENV, found", process.env.CYPRESS_ENV)
|
|
p = path.join(data, name, "cy", process.env.CYPRESS_ENV, paths...)
|
|
log("path: %s", p)
|
|
p
|
|
|
|
projectsPath: (paths...) ->
|
|
@path("projects", paths...)
|
|
|
|
remove: ->
|
|
Promise.join(
|
|
fs.removeAsync(@path())
|
|
@removeSymlink()
|
|
)
|
|
|
|
}
|