mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-02 21:10:47 -05:00
405e7f7ccb
* chore(webkit): update error stack parsing and related system tests
* Adding better comment
* Putting column back. Indexing at 1.
* Let's wait for WebKit fixes to land for this
* Using default name/location values already used in stack enhancing logic
* Incorrect bracket in regex
* Trying without location, as the fake location causes more problems downstream.
* Loosening regex around locations in stack replacement
* Defaulting location sans row/column
* Parsing stack lines for reporter with unique regex
* D'oh
* Making the validation against '<unknown>' more specific
* Don't want a capture group here
* Updating spec_isolation system tests
* Consolidating regex pattern to errors package
* Can just keep this global now
* Simplifying regex. Removing lineAndColumn numbers from unknown locations.
* Updating system test stack regex
* Getting better baseline
* Revert "Updating system test stack regex"
This reverts commit 2b91eff369.
* Forking normalization for webkit to track down diffs
* Ensure line or column are set before rendering in enhanced stack
* Need to be a little more flexible
* Tweaking leading newline detection
* Trying out new composed regex
* Few more tweaks for multiple leading newlines and file locations without function name
* Updating remainderOfStack pattern with proper escaping
* Cleaning up comments
* Filtering native code from absolute path logic
* Rebuild CI after outage
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
const fs = require('fs')
|
|
const Fixtures = require('../lib/fixtures')
|
|
const systemTests = require('../lib/system-tests').default
|
|
|
|
const onServer = function (app) {
|
|
app.get('/index.html', (req, res) => {
|
|
return res.send(`\
|
|
<html>
|
|
<body>
|
|
some bad js a comin'
|
|
</body>
|
|
</html>\
|
|
`)
|
|
})
|
|
|
|
app.get('/gzip-bad.html', (req, res) => {
|
|
const buf = fs.readFileSync(Fixtures.path('server/gzip-bad.html.gz'))
|
|
|
|
return res.set({
|
|
'content-type': 'text/html',
|
|
'content-encoding': 'gzip',
|
|
})
|
|
.send(buf)
|
|
})
|
|
|
|
return app.get('/gzip-bad.js', (req, res) => {
|
|
const buf = fs.readFileSync(Fixtures.path('server/gzip-bad.html.gz'))
|
|
|
|
return res.set({
|
|
'content-type': 'application/javascript',
|
|
'content-encoding': 'gzip',
|
|
})
|
|
.send(buf)
|
|
})
|
|
}
|
|
|
|
describe('e2e js error handling', () => {
|
|
systemTests.setup({
|
|
servers: [{
|
|
port: 1122,
|
|
static: true,
|
|
}, {
|
|
port: 1123,
|
|
onServer,
|
|
}],
|
|
})
|
|
|
|
systemTests.it('fails', {
|
|
spec: 'js_error_handling_failing.cy.js',
|
|
snapshot: true,
|
|
expectedExitCode: 5,
|
|
config: {
|
|
video: false,
|
|
},
|
|
onStdout (stdout) {
|
|
// firefox has a stack line for the cross-origin error that other browsers don't
|
|
return stdout
|
|
.replace(/cross-origin-script-error\s+?\(Results/, 'cross-origin-script-error\n\n (Results')
|
|
.replace(/cross-origin-script-error\s+at <unknown> \(http:\/\/localhost:1122\/static\/fail\.js:0:0\)\s+?\(Results/, 'cross-origin-script-error\n\n (Results')
|
|
},
|
|
})
|
|
})
|