mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-19 21:51:16 -06:00
* extract random string to util * run specs in isolation, aggregate totalFailures, display output per spec, enable globbing for specs * extract electron app ready into its own module * WIP: e2e tests around spec isolation, snapshots, stdout, and complete test results * removed unused and deprecated remove id's feature * move fs_warn to fs util to promisify an fs singleton * create a glob singleton util * cleanup dead removeIds code * extract files controller specs into its own file * extract finding specs out of project instance into its own utility with no state * use glob util singleton * use fs util singleton * lots of formatting and cleanup * fixes failing headless specs * fixes all failing unit tests * fixes failing integration test * WIP: temporarily throw old error msg * WIP: skip failing --record integration tests for now * fix failing e2e tests
69 lines
1.5 KiB
CoffeeScript
69 lines
1.5 KiB
CoffeeScript
os = require("os")
|
|
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")
|
|
fs = require("../util/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()
|
|
)
|
|
|
|
}
|