mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-24 01:08:50 -05:00
4b368830fa
* WIP: refactor runs and recordings, update to new API updates, iteratively send spec results [skip ci] * update / add schema deps * add takenAt to screenshots payload * WIP: refactor recordings to send correctly payloads, iterative through each spec, error handling, e2e tests * add missing properties, remove hacks, upload stdout, passing tests * normalize wall clock for newest schema spec * rename projectPath -> projectRoot for clarity * normalize specPattern to be relative to projectRoot * comment out lib/api debug code * WIP fixes a lot of failing tests * many more tests around recording * WIP: update to use x-os-name on all instead of platform * WIP: update to route version 4 for creating instances * server: upgrade json-schemas to 4.7.2 * remove debug logs * fix stdout not being restored correctly between specs * test all the edge cases with failed api interactions and early exits * add e2e tests around recording without projectID * add e2e tests around recording without recordKey * refactored all tests surrounding record mode, removed duplicates, tested only edge cases * fixes #1692 * fix failing unit tests, bump schemas * bump sinon, replace custom sandbox * fix sinon@5 not restoring fake timers automatically * missing e2e record snapshots * fix failing tests, don't pass config through each run, remove old timings in favor of spec isolation * more e2e test fixes * add e2e tests around uploading artifacts, fix bug with not uploading videos when it should - cleanup some dead code - add debug logs * cleanup dead code, remove notion of failingTests
50 lines
1.4 KiB
CoffeeScript
50 lines
1.4 KiB
CoffeeScript
md5 = require("md5")
|
|
path = require("path")
|
|
Promise = require("bluebird")
|
|
sanitize = require("sanitize-filename")
|
|
log = require("../log")
|
|
cwd = require("../cwd")
|
|
fs = require("../util/fs")
|
|
|
|
toHashName = (projectRoot) ->
|
|
throw new Error("Missing project path") unless projectRoot
|
|
throw new Error("Expected project absolute path, not just a name #{projectRoot}") unless path.isAbsolute(projectRoot)
|
|
name = sanitize(path.basename(projectRoot))
|
|
hash = md5(projectRoot)
|
|
"#{name}-#{hash}"
|
|
|
|
# async promise-returning method
|
|
formStatePath = (projectRoot) ->
|
|
Promise.resolve()
|
|
.then ->
|
|
log('making saved state from %s', cwd())
|
|
if projectRoot
|
|
log('for project path %s', projectRoot)
|
|
return projectRoot
|
|
else
|
|
log('missing project path, looking for project here')
|
|
|
|
cypressJsonPath = cwd('cypress.json')
|
|
fs.pathExists(cypressJsonPath)
|
|
.then (found) ->
|
|
if found
|
|
log('found cypress file %s', cypressJsonPath)
|
|
projectRoot = cwd()
|
|
return projectRoot
|
|
|
|
.then (projectRoot) ->
|
|
fileName = "state.json"
|
|
if projectRoot
|
|
log("state path for project #{projectRoot}")
|
|
statePath = path.join(toHashName(projectRoot), fileName)
|
|
else
|
|
log("state path for global mode")
|
|
statePath = path.join("__global__", fileName)
|
|
|
|
return statePath
|
|
|
|
module.exports = {
|
|
toHashName: toHashName,
|
|
formStatePath: formStatePath
|
|
}
|