jprichardson / jprichardson/node-suppose

String expect fails when there are more data after it

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
255
Forks
23
PR merge metrics
No merged PRs in 30d

Description

When using a string as expect it's only considered the end of the buffer. This is usually the normal case, but on the ones that there could be some more data after the expected string it will fail, while at the same time by using a RegExp matching for the same string it works. When using a string, I would use the method indexOf instead of endsWith, or maybe better, convert the string to a RegExp object.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/suppose-process.js at line 59, where string expectations are checked, and compare that behavior with the RegExp path described in the issue. Verify that a string expectation succeeds when matching data is followed by additional data, while preserving the existing end-of-buffer behavior where appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.