Allow optional configuration of expected line endings for TAPTestEngine#20
Open
farrago wants to merge 1 commit intotagview:masterfrom
Open
Allow optional configuration of expected line endings for TAPTestEngine#20farrago wants to merge 1 commit intotagview:masterfrom
farrago wants to merge 1 commit intotagview:masterfrom
Conversation
= 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 on `PHP_EOL`. This is a problem if the output it is parsing has any other line endings. For example, [mochajs](mochajs.org) 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 `mochajs` tests run through `gulp`, the following config would allow the results to be correctly parsed: ``` "unit.engine": "TAPTestEngine", "unit.engine.tap.command": "gulp test", "unit.engine.tap.eol": "\n" ``` = 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) * Test TAP output with `"\r\n"` end-of-lines and check it is parsed correctly * Test TAP output with `"\n"` end-of-lines and check it is NOT parsed * Set `"unit.engine.tap.eol": "\n"` in `.arcconfig` (i.e. different line ending than OS) * Test TAP output with `"\r\n"` end-of-lines and check it is now NOT parsed * Test TAP output with `"\n"` end-of-lines and check it is parsed correctly * Set `"unit.engine.tap.eol": "\n"` in `.arcconfig` (i.e. explicitly same line ending as OS) * Test TAP output with `"\r\n"` end-of-lines and check it is parsed correctly * Test TAP output with `"\n"` end-of-lines and check it is NOT parsed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_EOLif not configured.Discussion
Previously
TAPTestEnginesplits 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
Mochatests 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