Skip to content

Commit

Permalink
Merge branch 'develop' into fix/broken-css
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaSachs authored Mar 17, 2021
2 parents 1aabdaa + 6abc245 commit 808bceb
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/example/cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"projectId": "2pz86o"
}

95 changes: 95 additions & 0 deletions packages/server/__snapshots__/7_record_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2531,3 +2531,98 @@ exports['e2e record api skips specs records tests and exits without executing in
Exiting with non-zero exit code because the run was canceled.
`

exports['e2e record empty specs succeeds when empty spec file 1'] = `
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 1.2.3 │
│ Browser: FooBrowser 88 │
│ Specs: 2 found (empty_suite.spec.js, empty.spec.js) │
│ Searched: cypress/integration/empty_suite.spec.js, cypress/integration/empty.spec.js │
│ Params: Tag: false, Group: false, Parallel: false │
│ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: empty_suite.spec.js (1 of 2)
Estimated: 8 seconds
0 passing
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 0 │
│ Passing: 0 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: X seconds │
│ Estimated: 8 seconds │
│ Spec Ran: empty_suite.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Uploading Results)
- Nothing to Upload
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: empty.spec.js (2 of 2)
Estimated: 8 seconds
0 passing
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 0 │
│ Passing: 0 │
│ Failing: 0 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: true │
│ Duration: X seconds │
│ Estimated: 8 seconds │
│ Spec Ran: empty.spec.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Uploading Results)
- Nothing to Upload
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ empty_suite.spec.js XX:XX - - - - - │
├────────────────────────────────────────────────────────────────────────────────────────────────┤
│ ✔ empty.spec.js XX:XX - - - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! XX:XX - - - - -
───────────────────────────────────────────────────────────────────────────────────────────────────────
Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12
`
6 changes: 5 additions & 1 deletion packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,13 @@ const createRunAndRecordSpecs = (options = {}) => {
const onTestsReceived = (async (runnables, cb) => {
// we failed createInstance earlier, nothing to do
if (!instanceId) {
return
return cb()
}

// runnables will be null when there' no tests
// this also means runtimeConfig will be missing
runnables = runnables || {}

const r = testsUtils.flattenSuiteIntoRunnables(runnables)
const runtimeConfig = runnables.runtimeConfig
const resolvedRuntimeConfig = Config.getResolvedRuntimeConfig(config, runtimeConfig)
Expand Down
5 changes: 5 additions & 0 deletions packages/server/lib/util/tests_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const flattenSuiteIntoRunnables = (suite, tests = [], hooks = []) => {
)
}

// if we dont have a suite, return early
if (!suite || !suite.suites) {
return [tests, hooks]
}

tests = tests.concat(suite.tests)
hooks = hooks.concat(suite.hooks)

Expand Down
30 changes: 30 additions & 0 deletions packages/server/test/e2e/7_record_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,36 @@ describe('e2e record', () => {
})
})

context('empty specs', () => {
setupStubbedServer(createRoutes())

// https://github.com/cypress-io/cypress/issues/15512
it('succeeds when empty spec file', async function () {
await e2e.exec(this, {
key: 'f858a2bc-b469-4e48-be67-0876339ee7e1',
record: true,
spec: 'empty_suite.spec.js,empty.spec.js',
snapshot: true,
expectedExitCode: 0,
})

expect(getRequestUrls()).deep.eq([
'POST /runs',
`POST /runs/${runId}/instances`,
`POST /instances/${instanceId}/tests`,
`POST /instances/${instanceId}/results`,
`PUT /instances/${instanceId}/stdout`,

`POST /runs/${runId}/instances`,
`POST /instances/${instanceId}/tests`,
`POST /instances/${instanceId}/results`,
`PUT /instances/${instanceId}/stdout`,

`POST /runs/${runId}/instances`,
])
})
})

context('projectId', () => {
e2e.setup()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('no tests!')
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
console.log('no tests!')

describe('suite', () => {
})

0 comments on commit 808bceb

Please sign in to comment.