Skip to content

Replace match with test and omit redundant String conversion in jest-diff#4311

Merged
cpojer merged 1 commit intojestjs:masterfrom
pedrottimark:jest-diff-string
Aug 23, 2017
Merged

Replace match with test and omit redundant String conversion in jest-diff#4311
cpojer merged 1 commit intojestjs:masterfrom
pedrottimark:jest-diff-string

Conversation

@pedrottimark
Copy link
Contributor

Summary

  • Rewrote condition with RegExp.test because String.match is equivalent to RegExp.exec which returns either null or an array, therefore first condition was always false.
  • Removed explicit conversion with String constructor, because switch (aType) case 'string' and have already returned if expectedType !== getType(b) or string asymmetric matcher.

Test plan

  • Deleted stripAnsi from 2 existing tests with toBe(null) assertion
  • Added 2 tests for either a or b is one line. The test for a one line and b multi line failed first.

@pedrottimark pedrottimark changed the title Replace match with test and omit redundant String conversion Replace match with test and omit redundant String conversion in jest-diff Aug 21, 2017
@pedrottimark pedrottimark mentioned this pull request Aug 23, 2017
6 tasks
@cpojer cpojer merged commit 0febe44 into jestjs:master Aug 23, 2017
@pedrottimark pedrottimark deleted the jest-diff-string branch August 23, 2017 14:20
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants