mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-05 14:09:46 -06:00
fix: junit reporters crashing on failed asserts (#24677)
* fix: junit reporters crashing on failures * handle other platforms * Fix system tests * fix snapshot * fix snapshot * fix snapshot
This commit is contained in:
@@ -9,6 +9,8 @@ We searched for the reporter in these paths:
|
||||
Learn more at https://on.cypress.io/reporters
|
||||
|
||||
Error: Cannot find module '/foo/bar/.projects/e2e/node_modules/module-does-not-exist'
|
||||
Require stack:
|
||||
- lib/reporter.js
|
||||
[stack trace lines]
|
||||
`
|
||||
|
||||
@@ -21,14 +23,14 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = `
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Cypress: 1.2.3 │
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (simple_passing.cy.js) │
|
||||
│ Searched: cypress/e2e/simple_passing.cy.js │
|
||||
│ Specs: 2 found (simple_passing.cy.js, simple_failing.cy.js) │
|
||||
│ Searched: cypress/e2e/simple_passing.cy.js, cypress/e2e/simple_failing.cy.js │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Running: simple_passing.cy.js (1 of 1)
|
||||
Running: simple_passing.cy.js (1 of 2)
|
||||
|
||||
(Results)
|
||||
|
||||
@@ -51,6 +53,39 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = `
|
||||
- Finished processing: /XXX/XXX/XXX/cypress/videos/simple_passing.cy.js.mp4 (X second)
|
||||
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Running: simple_failing.cy.js (2 of 2)
|
||||
|
||||
(Results)
|
||||
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Tests: 2 │
|
||||
│ Passing: 0 │
|
||||
│ Failing: 2 │
|
||||
│ Pending: 0 │
|
||||
│ Skipped: 0 │
|
||||
│ Screenshots: 2 │
|
||||
│ Video: true │
|
||||
│ Duration: X seconds │
|
||||
│ Spec Ran: simple_failing.cy.js │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
(Screenshots)
|
||||
|
||||
- /XXX/XXX/XXX/cypress/screenshots/simple_failing.cy.js/simple failing spec -- fai (1280x720)
|
||||
ls1 (failed).png
|
||||
- /XXX/XXX/XXX/cypress/screenshots/simple_failing.cy.js/simple failing spec -- fai (1280x720)
|
||||
ls2 (failed).png
|
||||
|
||||
|
||||
(Video)
|
||||
|
||||
- Started processing: Compressing to 32 CRF
|
||||
- Finished processing: /XXX/XXX/XXX/cypress/videos/simple_failing.cy.js.mp4 (X second)
|
||||
|
||||
|
||||
====================================================================================================
|
||||
|
||||
(Run Finished)
|
||||
@@ -59,8 +94,10 @@ exports['e2e reporters supports junit reporter and reporter options 1'] = `
|
||||
Spec Tests Passing Failing Pending Skipped
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ ✔ simple_passing.cy.js XX:XX 1 1 - - - │
|
||||
├────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ✖ simple_failing.cy.js XX:XX 2 - 2 - - │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
✔ All specs passed! XX:XX 1 1 - - -
|
||||
✖ 1 of 2 failed (50%) XX:XX 3 1 2 - -
|
||||
|
||||
|
||||
`
|
||||
|
||||
@@ -36,22 +36,30 @@ describe('e2e reporters', () => {
|
||||
|
||||
it('supports junit reporter and reporter options', function () {
|
||||
return systemTests.exec(this, {
|
||||
spec: 'simple_passing.cy.js',
|
||||
spec: 'simple_passing.cy.js,simple_failing.cy.js',
|
||||
snapshot: true,
|
||||
reporter: 'junit',
|
||||
reporterOptions: 'mochaFile=junit-output/result.[hash].xml,testCaseSwitchClassnameAndName=true',
|
||||
expectedExitCode: 2,
|
||||
})
|
||||
.then(() => {
|
||||
return glob(path.join(e2ePath, 'junit-output', 'result.*.xml'))
|
||||
.then((paths) => {
|
||||
expect(paths.length).to.eq(1)
|
||||
expect(paths.length).to.eq(2)
|
||||
|
||||
return Promise.all([fs.readFileAsync(paths[0], 'utf8'), fs.readFileAsync(paths[1], 'utf8')])
|
||||
.then((results) => {
|
||||
const str = results.join('')
|
||||
|
||||
return fs.readFileAsync(paths[0], 'utf8')
|
||||
.then((str) => {
|
||||
expect(str).to.include('<testsuite name="simple passing spec"')
|
||||
expect(str).to.include('<testcase name="passes"')
|
||||
|
||||
expect(str).to.include('classname="simple passing spec passes"')
|
||||
|
||||
expect(str).to.include('<testsuite name="simple failing spec"')
|
||||
expect(str).to.include('<testcase name="fails1"')
|
||||
expect(str).to.include('<testcase name="fails2"')
|
||||
expect(str).to.include('classname="simple failing spec fails1"')
|
||||
expect(str).to.include('classname="simple failing spec fails2"')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -50,12 +50,16 @@
|
||||
"./packages/https-proxy/lib/ca.js",
|
||||
"./packages/net-stubbing/node_modules/debug/src/node.js",
|
||||
"./packages/network/node_modules/minimatch/minimatch.js",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/capture.js",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/modes/record.js",
|
||||
"./packages/server/lib/modes/run.ts",
|
||||
"./packages/server/lib/open_project.ts",
|
||||
"./packages/server/lib/project-base.ts",
|
||||
"./packages/server/lib/socket-ct.ts",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/util/suppress_warnings.js",
|
||||
"./packages/server/node_modules/@benmalka/foxdriver/node_modules/graceful-fs/polyfills.js",
|
||||
"./packages/server/node_modules/glob/node_modules/minimatch/minimatch.js",
|
||||
@@ -825,20 +829,17 @@
|
||||
"./packages/server/lib/browsers/firefox-util.ts",
|
||||
"./packages/server/lib/browsers/firefox.ts",
|
||||
"./packages/server/lib/browsers/index.ts",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/browsers/webkit-automation.ts",
|
||||
"./packages/server/lib/browsers/webkit.ts",
|
||||
"./packages/server/lib/cache.js",
|
||||
"./packages/server/lib/cloud/api.ts",
|
||||
"./packages/server/lib/cloud/auth.ts",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/cloud/routes.ts",
|
||||
"./packages/server/lib/cloud/user.ts",
|
||||
"./packages/server/lib/config.ts",
|
||||
"./packages/server/lib/controllers/iframes.ts",
|
||||
"./packages/server/lib/cypress.js",
|
||||
"./packages/server/lib/environment.js",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/gui/windows.ts",
|
||||
"./packages/server/lib/log.js",
|
||||
"./packages/server/lib/makeDataContext.ts",
|
||||
@@ -869,7 +870,6 @@
|
||||
"./packages/server/lib/util/file-opener.ts",
|
||||
"./packages/server/lib/util/fs.ts",
|
||||
"./packages/server/lib/util/glob.js",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/util/proxy.ts",
|
||||
"./packages/server/lib/util/resourceTypeAndCredentialManager.ts",
|
||||
"./packages/server/lib/util/socket_allowed.ts",
|
||||
|
||||
@@ -50,10 +50,14 @@
|
||||
"./packages/https-proxy/lib/ca.js",
|
||||
"./packages/net-stubbing/node_modules/debug/src/node.js",
|
||||
"./packages/network/node_modules/minimatch/minimatch.js",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/capture.js",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/modes/record.js",
|
||||
"./packages/server/lib/modes/run.ts",
|
||||
"./packages/server/lib/open_project.ts",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/project-base.ts",
|
||||
"./packages/server/lib/socket-ct.ts",
|
||||
"./packages/server/lib/util/suppress_warnings.js",
|
||||
@@ -824,20 +828,17 @@
|
||||
"./packages/server/lib/browsers/firefox-util.ts",
|
||||
"./packages/server/lib/browsers/firefox.ts",
|
||||
"./packages/server/lib/browsers/index.ts",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/browsers/webkit-automation.ts",
|
||||
"./packages/server/lib/browsers/webkit.ts",
|
||||
"./packages/server/lib/cache.js",
|
||||
"./packages/server/lib/cloud/api.ts",
|
||||
"./packages/server/lib/cloud/auth.ts",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/cloud/routes.ts",
|
||||
"./packages/server/lib/cloud/user.ts",
|
||||
"./packages/server/lib/config.ts",
|
||||
"./packages/server/lib/controllers/iframes.ts",
|
||||
"./packages/server/lib/cypress.js",
|
||||
"./packages/server/lib/environment.js",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/gui/windows.ts",
|
||||
"./packages/server/lib/log.js",
|
||||
"./packages/server/lib/makeDataContext.ts",
|
||||
@@ -868,7 +869,6 @@
|
||||
"./packages/server/lib/util/file-opener.ts",
|
||||
"./packages/server/lib/util/fs.ts",
|
||||
"./packages/server/lib/util/glob.js",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/util/proxy.ts",
|
||||
"./packages/server/lib/util/resourceTypeAndCredentialManager.ts",
|
||||
"./packages/server/lib/util/socket_allowed.ts",
|
||||
|
||||
@@ -50,10 +50,14 @@
|
||||
"./packages/https-proxy/lib/ca.js",
|
||||
"./packages/net-stubbing/node_modules/debug/src/node.js",
|
||||
"./packages/network/node_modules/minimatch/minimatch.js",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/capture.js",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/modes/record.js",
|
||||
"./packages/server/lib/modes/run.ts",
|
||||
"./packages/server/lib/open_project.ts",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/project-base.ts",
|
||||
"./packages/server/lib/socket-ct.ts",
|
||||
"./packages/server/lib/util/suppress_warnings.js",
|
||||
@@ -827,20 +831,17 @@
|
||||
"./packages/server/lib/browsers/firefox-util.ts",
|
||||
"./packages/server/lib/browsers/firefox.ts",
|
||||
"./packages/server/lib/browsers/index.ts",
|
||||
"./packages/server/lib/browsers/utils.ts",
|
||||
"./packages/server/lib/browsers/webkit-automation.ts",
|
||||
"./packages/server/lib/browsers/webkit.ts",
|
||||
"./packages/server/lib/cache.js",
|
||||
"./packages/server/lib/cloud/api.ts",
|
||||
"./packages/server/lib/cloud/auth.ts",
|
||||
"./packages/server/lib/cloud/exception.ts",
|
||||
"./packages/server/lib/cloud/routes.ts",
|
||||
"./packages/server/lib/cloud/user.ts",
|
||||
"./packages/server/lib/config.ts",
|
||||
"./packages/server/lib/controllers/iframes.ts",
|
||||
"./packages/server/lib/cypress.js",
|
||||
"./packages/server/lib/environment.js",
|
||||
"./packages/server/lib/errors.ts",
|
||||
"./packages/server/lib/gui/windows.ts",
|
||||
"./packages/server/lib/log.js",
|
||||
"./packages/server/lib/makeDataContext.ts",
|
||||
@@ -871,7 +872,6 @@
|
||||
"./packages/server/lib/util/file-opener.ts",
|
||||
"./packages/server/lib/util/fs.ts",
|
||||
"./packages/server/lib/util/glob.js",
|
||||
"./packages/server/lib/util/process_profiler.ts",
|
||||
"./packages/server/lib/util/proxy.ts",
|
||||
"./packages/server/lib/util/resourceTypeAndCredentialManager.ts",
|
||||
"./packages/server/lib/util/socket_allowed.ts",
|
||||
|
||||
@@ -58,6 +58,10 @@ export default [
|
||||
'packages/server/lib/open_project.ts',
|
||||
'packages/server/lib/project-base.ts',
|
||||
'packages/server/lib/socket-ct.ts',
|
||||
'packages/server/lib/browsers/utils.ts',
|
||||
'packages/server/lib/cloud/exception.ts',
|
||||
'packages/server/lib/errors.ts',
|
||||
'packages/server/lib/util/process_profiler.ts',
|
||||
'node_modules/prettier/index.js',
|
||||
'node_modules/prettier/parser-babel.js',
|
||||
'node_modules/prettier/parser-espree.js',
|
||||
|
||||
Reference in New Issue
Block a user