mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-08 07:50:24 -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
56 lines
1.3 KiB
CoffeeScript
56 lines
1.3 KiB
CoffeeScript
require("../spec_helper")
|
|
|
|
capture = require("#{root}lib/capture")
|
|
|
|
describe "lib/capture", ->
|
|
afterEach ->
|
|
capture.restore()
|
|
|
|
context "process.stdout.write", ->
|
|
beforeEach ->
|
|
@write = sinon.spy(process.stdout, "write")
|
|
@captured = capture.stdout()
|
|
|
|
it "slurps up stdout", ->
|
|
console.log("foo")
|
|
console.log("bar")
|
|
process.stdout.write("baz")
|
|
|
|
expect(@captured.data).to.deep.eq([
|
|
"foo\n"
|
|
"bar\n"
|
|
"baz"
|
|
])
|
|
|
|
expect(@captured.toString()).to.eq("foo\nbar\nbaz")
|
|
|
|
## should still call through to write
|
|
expect(@write).to.be.calledWith("foo\n")
|
|
expect(@write).to.be.calledWith("bar\n")
|
|
expect(@write).to.be.calledWith("baz")
|
|
|
|
context "process.log", ->
|
|
beforeEach ->
|
|
@log = process.log
|
|
@logStub = process.log = sinon.stub()
|
|
|
|
@captured = capture.stdout()
|
|
|
|
afterEach ->
|
|
process.log = @log
|
|
|
|
it "slurps up logs", ->
|
|
process.log("foo\n")
|
|
process.log("bar\n")
|
|
|
|
expect(@captured.data).to.deep.eq([
|
|
"foo\n"
|
|
"bar\n"
|
|
])
|
|
|
|
expect(@captured.toString()).to.eq("foo\nbar\n")
|
|
|
|
## should still call through to write
|
|
expect(@logStub).to.be.calledWith("foo\n")
|
|
expect(@logStub).to.be.calledWith("bar\n")
|