fix(assert): Add default name for no test name. #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all I'm a big fan of tape! Thanks for that 😄
I just discovered playing around with a custom TAP reporter for COBOL, (yep COBOL 😅) that whenever a TAP report has no name after the test or the name has no space
faucetfails to parse the line.For example given the following TAP as input:
or (without the space)
/Users/alvaropinot/work/alvaropinot/faucet/index.js:38 var s = trim(res.name.trim()); ^ TypeError: Cannot read property 'trim' of undefined at Parser.<anonymous> (/Users/alvaropinot/work/alvaropinot/faucet/index.js:38:34) at emitOne (events.js:101:20) at Parser.emit (events.js:191:7) at Parser._online (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/tap-parser/index.js:131:14) at Parser._write (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/tap-parser/index.js:53:14) at doWrite (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/readable-stream/lib/_stream_writable.js:279:12) at writeOrBuffer (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/readable-stream/lib/_stream_writable.js:266:5) at Parser.Writable.write (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/readable-stream/lib/_stream_writable.js:211:11) at Stream.method [as write] (/Users/alvaropinot/work/alvaropinot/faucet/node_modules/duplexer/index.js:47:39) at Socket.ondata (_stream_readable.js:557:20)This is a fix that prevents the problem but maybe the
tap-parsershould be fixed instead. I tried to follow the ES5 syntax and already existing style but please feel free to let me know any code standard/style that you want me to follow, if you want to merge this PR.I was willing to add both scenarios as tests but looks like there is none 😅, quite ironic being a test output lib 😜
Can you confirm if there is any other implications about changing https://github.com/substack/faucet/blob/0fabf821eb142dc75a318c5cd408d7653279bb00/index.js#L38 looks like name is used in some other lines 😄
This are the proposed changes 👇
fix(assert): Add default name for no test name.
DEFAULT_TEST_NAME.res.namehas a value or useDEFAULT_TEST_NAME.