Allow optional configuration of expected line endings for TAPTestEngine #20
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.
Summary
Add optional
"unit.engine.tap.eol"
config option for specifying line ending to split results by.Defaults to
PHP_EOL
if not configured.Discussion
Previously
TAPTestEngine
splits the lines of TAP output onPHP_EOL
. This is a problem if the output it is parsing has any other line endings. For example, the Mocha test framework for NodeJS always outputs its TAP results with"\n"
as the line ending, even on Windows.This revision adds a new, optional, config parameter to allow the line ending to be specified in
.arcconfig
.E.g. in the case above with
Mocha
tests run throughgulp
, the following config would allow the results to be correctly parsed:Backwards compatibility
If the config line is not added, the default remains as
PHP_EOL
, so existing users will be unaffected.Test Plan
On Windows (i.e.
PHP_EOL
=="\r\n"
):Leave
"unit.engine.tap.eol"
unset (i.e. legacy configs)"\r\n"
end-of-lines and check it is parsed correctly"\n"
end-of-lines and check it is NOT parsedSet
"unit.engine.tap.eol": "\n"
in.arcconfig
(i.e. different line ending than OS)"\r\n"
end-of-lines and check it is now NOT parsed"\n"
end-of-lines and check it is parsed correctlySet
"unit.engine.tap.eol": "\r\n"
in.arcconfig
(i.e. explicitly same line ending as OS)"\r\n"
end-of-lines and check it is parsed correctly"\n"
end-of-lines and check it is NOT parsed