Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Limit the size of 'actual'/'expected' strings before generating a diff#4638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
juergba merged 2 commits intomasterfromjuergba/diff
May 30, 2021

Conversation

juergba
Copy link
Contributor

@juergbajuergba commentedMay 24, 2021
edited
Loading

Description

Mocha prints its own diff on assertion errors by stringifyingerr.actual anderr.expected, then passing both strings tojsdiff for generating a diff-patch. For big strings this synchronous process can take several minutes.

jsdiff has some known performance issues, so in mid-term we evtl. should evaluate ajsdiff alternative.
On the other hand it's not a good idea to calculate a diff for two huge strings, even with a faster algorithm. We should limit the size of the input strings, as eg. done by Node'sassert as well.

Description of the Change

  • no change: stringifyerr.actual anderr.expected
  • new: when too big, truncate the resulting strings and add a message... Lines skipped

Applicable issues

closes#3675

jnordberg and olivierlacan reacted with thumbs down emojikevinoid reacted with hooray emoji
@juergbajuergba self-assigned thisMay 24, 2021
@juergbajuergba added type: buga defect, confirmed by a maintainer dependenciesPull requests that update a dependency file type: performancePerformance improvements semver-majorimplementation requires increase of "major" version number; "breaking changes" labelsMay 24, 2021
@juergbajuergba added this to thev9.0.0 milestoneMay 24, 2021
@juergbajuergba requested a review froma teamMay 24, 2021 14:25
@juergbajuergba merged commita93d759 intomasterMay 30, 2021
@juergbajuergba deleted the juergba/diff branchMay 30, 2021 16:29
@@ -164,6 +164,34 @@ describe('Base reporter', function() {
' \n actual expected\n \n a foobar inline diff\n '
);
});

it("should truncate overly long 'actual' ", function() {
var actual = '';

Choose a reason for hiding this comment

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

Hello, I'm trying to contribute to Mocha and before I do I'm trying to get idea of mocha's coding style. I want to know why you used 'var' instea of 'const' or 'let'. Thank you in advance.

@joshgoebel
Copy link

joshgoebel commentedOct 7, 2021
edited
Loading

Can this be a feature flag please so it can be disabled? I was having NO speed issues before but not my test output is entirely broken (it doesn't show the actual diff at all) because it's a bit over 2000 characters.☹️

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@joielee09joielee09joielee09 left review comments

Assignees

@juergbajuergba

Labels
dependenciesPull requests that update a dependency filesemver-majorimplementation requires increase of "major" version number; "breaking changes"type: buga defect, confirmed by a maintainertype: performancePerformance improvements
Projects
None yet
Milestone
v9.0.0
Development

Successfully merging this pull request may close these issues.

Mocha failing when error message too big
3 participants
@juergba@joshgoebel@joielee09

[8]ページ先頭

©2009-2025 Movatter.jp