Skip to content

Commit

Permalink
Merge pull request #102 from chiefmyron:chiefmyron/issue101
Browse files Browse the repository at this point in the history
Chiefmyron/issue101
  • Loading branch information
chiefmyron authored May 6, 2024
2 parents 85a4c3a + 8f1dc35 commit 13ee145
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [0.7.4] - 2024-05-07
### Fixed
- Error peek not appearing on correct line when running Laravel v10.x tests ([#101](https://github.com/chiefmyron/phpunit-test-workbench/issues/101))

## [0.7.3] - 2024-05-05
### Changed
- Shift peek for test failures to appear on the line where the test failure occurred ([#98](https://github.com/chiefmyron/phpunit-test-workbench/issues/98))
Expand Down Expand Up @@ -152,6 +156,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.0] - 2022-10-14
- Initial release

[0.7.4]: https://github.com/chiefmyron/phpunit-test-workbench/compare/v0.7.3...v0.7.4
[0.7.3]: https://github.com/chiefmyron/phpunit-test-workbench/compare/v0.7.2...v0.7.3
[0.7.2]: https://github.com/chiefmyron/phpunit-test-workbench/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/chiefmyron/phpunit-test-workbench/compare/v0.7.0...v0.7.1
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ To run test coverage, either:
![Execute tests via commands](docs/images/example-commands.gif)

## Release notes
### v0.7.3 - 2024-05-02
### v0.7.4 - 2024-05-07
* __FIXED:__ Error peek not appearing on correct line when running Laravel v10.x tests ([#101](https://github.com/chiefmyron/phpunit-test-workbench/issues/101))

### v0.7.3 - 2024-05-05
* __CHANGED:__ Shift peek for test failures to appear on the line where the test failure occurred ([#98](https://github.com/chiefmyron/phpunit-test-workbench/issues/98))

### v0.7.2 - 2024-05-02
Expand Down
20 changes: 14 additions & 6 deletions src/runner/TestResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,19 @@ export class TestResult {
messageDetail = this.parseEscapedTeamcityString(messageDetail);

// Check for specific error location (line number)
let messageDetailLines = messageDetail.split("\r\n");
let messageLine = messageDetailLines.pop();
if (messageLine && messageLine.indexOf(':') > 0) {
let messageLineParts = messageLine.split(':');
this.messageLineNum = Number(messageLineParts.pop());
let messageDetailLines = messageDetail.split("\r\n");
while (messageDetailLines.length) {
let messageLine = messageDetailLines.pop();
if (messageLine && messageLine.indexOf(':') > 0) {
let messageLineParts = messageLine.split(':');
let lineNumStr = messageLineParts.pop();
let filePathStr = messageLineParts.join(':'); // Handle Windows paths, which include a : in the drive assignment
let messageLineUri = vscode.Uri.file(filePathStr);
if (messageLineUri.fsPath === this.testItem.uri?.fsPath) {
this.messageLineNum = Number(lineNumStr);
break;
}
}
}
this.messageDetail = messageDetail;
}
Expand Down Expand Up @@ -213,7 +221,7 @@ export class TestResult {
value = value.replace(/\|\[/g, '\['); // Open square bracket
value = value.replace(/\|\]/g, '\]'); // Close square bracket
value = value.replace(/\|r\|n/g, '\r\n'); // Carriage return + line break
value = value.replace(/\|n/g, '\n'); // Line break only
value = value.replace(/\|n/g, '\r\n'); // Line break only
return value.trim();
}
}

0 comments on commit 13ee145

Please sign in to comment.