mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-28 19:00:03 -05:00
4ec77e3d58
* use Node path from config file to run plugins
* add finding system node
* memoize node find, use fix-path if Node is not found
* find Node asynchronously
* update note on ENFILE
* print node version before executing registered event
* use nodeVersion option, add validator isOneOf
* linting
* remove resolve-dir
* debugging unit test
* resolve original promise to make the tests run correctly
* update second test
* add unit tests
* upgrade snap-shot-it package to be able to update snapshots
* make finding node path part of startup, merge into config
* update tests
* add node version & path to run output
* add node version display to desktop-gui
* add warnings, add tests, add learn more link in desktop-gui
* Revert "add node version & path to run output"
This reverts commit 40a3218175.
* only show Node Version if it is non-default
* Add e2e test for using system node
* cleanup
* add tests that resolvedNodePath and Version are available in tests
* assert nodeVersion == system
* add nodeVersion to schema
* add new configoptions to types
* add fallback if pluginsfile is disabled
* new package.json sorting
* update some of the wording/styling of Node Version panel
* remove ` from schema file
* clean up decaffeinated tests + update wording when no pluginsfile is present
* playing with messaging.
* push updated node version panel design
* update design + copy of Node panel again
* some more iteration on design (WIP)
* Finish design changes + fix tests
* add debug message
* linting problems
* add missed require
* Add comment to refactor the colWidths in this PR after another PR goes
* replace the exact length of Node version in specfiles
* print object for node version and path instead of %s %s
* update snapshot to match v12 length
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
68 lines
1.8 KiB
CoffeeScript
68 lines
1.8 KiB
CoffeeScript
_ = require("lodash")
|
|
EE = require("events")
|
|
debug = require("debug")("cypress:server:plugins")
|
|
Promise = require("bluebird")
|
|
|
|
UNDEFINED_SERIALIZED = "__cypress_undefined__"
|
|
|
|
serializeError = (err) ->
|
|
_.pick(err, "name", "message", "stack", "code", "annotated")
|
|
|
|
module.exports = {
|
|
serializeError: serializeError
|
|
|
|
wrapIpc: (aProcess) ->
|
|
emitter = new EE()
|
|
|
|
aProcess.on "message", (message) ->
|
|
emitter.emit(message.event, message.args...)
|
|
|
|
return {
|
|
send: (event, args...) ->
|
|
return if aProcess.killed
|
|
|
|
aProcess.send({
|
|
event: event
|
|
args
|
|
})
|
|
|
|
on: emitter.on.bind(emitter)
|
|
removeListener: emitter.removeListener.bind(emitter)
|
|
}
|
|
|
|
wrapChildPromise: (ipc, invoke, ids, args = []) ->
|
|
Promise.try ->
|
|
return invoke(ids.eventId, args)
|
|
.then (value) ->
|
|
## undefined is coerced into null when sent over ipc, but we need
|
|
## to differentiate between them for 'task' event
|
|
if value is undefined
|
|
value = UNDEFINED_SERIALIZED
|
|
ipc.send("promise:fulfilled:#{ids.invocationId}", null, value)
|
|
.catch (err) ->
|
|
ipc.send("promise:fulfilled:#{ids.invocationId}", serializeError(err))
|
|
|
|
wrapParentPromise: (ipc, eventId, callback) ->
|
|
invocationId = _.uniqueId("inv")
|
|
|
|
new Promise (resolve, reject) ->
|
|
handler = (err, value) ->
|
|
ipc.removeListener("promise:fulfilled:#{invocationId}", handler)
|
|
|
|
if err
|
|
debug("promise rejected for id %s %o", invocationId, ":", err.stack)
|
|
reject(_.extend(new Error(err.message), err))
|
|
return
|
|
|
|
if value is UNDEFINED_SERIALIZED
|
|
value = undefined
|
|
|
|
debug("promise resolved for id '#{invocationId}' with value", value)
|
|
|
|
resolve(value)
|
|
|
|
ipc.on("promise:fulfilled:#{invocationId}", handler)
|
|
|
|
callback(invocationId)
|
|
}
|