Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

fix: fix compilation error message #63

Merged
merged 3 commits into from
Feb 21, 2020
Merged

Conversation

kuceb
Copy link
Contributor

@kuceb kuceb commented Feb 21, 2020

append error to error.message instead of error.stack

  • this fixes strange issue where the stack will not contain the code-frame and only keep the stacktrace
  • also fixes issue with Error: Webpack Compilation Error not showing up in the error
  • makes hack around e.originalStack unnecessary

fix #64

err.stack = jsonStats.errors.join('\n\n')
err.message += `\n${jsonStats.errors
// remove stack trace lines since they're useless for debugging
.map((err) => err.replace(/\n\s*at.*/g, '').replace(/From previous event:\n?/g, ''))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this same logic is used in test runner to strip stack trace lines, so we're just moving this logic up
https://github.com/cypress-io/cypress/blob/master/packages/server/lib/plugins/preprocessor.coffee#L16

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ughh, this is so so weird - why have 3 lines of code inside a string template?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint auto-fixed to that when i tried to add '\n'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

bahmutov
bahmutov previously approved these changes Feb 21, 2020
@bahmutov
Copy link
Contributor

I have noticed this says "fix:" but does not reference an issue and does not have a test

@kuceb
Copy link
Contributor Author

kuceb commented Feb 21, 2020

snapshot is updated, but I'll add an assertion and open an issue

@kuceb kuceb requested a review from bahmutov February 21, 2020 18:38
@kuceb kuceb merged commit 731127d into master Feb 21, 2020
panzarino pushed a commit to cypress-io/cypress that referenced this pull request Sep 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no codeframe in cypress dev mode
2 participants