Skip to content

Commit

Permalink
Merge pull request #35 from matepek/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
matepek authored Dec 17, 2018
2 parents 35ddb81 + 8ded3da commit 9a06bce
Show file tree
Hide file tree
Showing 12 changed files with 330 additions and 237 deletions.
21 changes: 8 additions & 13 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ name: Bug report
about: Create a report to help us improve
---

**Describe the bug**
A clear and concise description of what the bug is.
**Before you file an issue, please check the [README.md](https://github.com/matepek/vscode-catch2-test-adapter#known-issues)'s known issues section.**

**To Reproduce**
Steps to reproduce the behavior:
**Describe the bug** (A clear and concise description of what the bug is.)

**To Reproduce** (Steps to reproduce the behavior:)

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.
**Expected behavior** (A clear and concise description of what you expected to happen.)

**Screenshots**
If applicable, add screenshots to help explain your problem.
**Screenshots** (If applicable, add screenshots to help explain your problem.)

**Desktop (please complete the following information):**

Expand All @@ -27,9 +25,6 @@ If applicable, add screenshots to help explain your problem.
- Catch2 Version
- OS Type and Version

**Log**
Attach log. (optional, Set: `catch2TestExplorer.logfile` and reproduce the bug.)
_Warning_: Log probably contains file and test names too. Consider security concerns before you attach it!
**Log** (Attach log. (optional, Set: `catch2TestExplorer.logfile` and reproduce the bug.) _Warning_: Log probably contains file and test names too.)

**Additional context**
Add any other context about the problem here.
**Additional context** Add any other context about the problem here.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.3.0]

Better error handling and logging.

### Added

- `catch2TestExplorer.defaultRunningTimeoutSec` to prevent infinite loops


## [2.2.6] - 2018-12-10

Stability improvements.
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ This extension allows you to run your [Catch2 tests](https://github.com/catchorg

## Configuration

| Property | Description |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `catch2TestExplorer.executables` | The location of your test executables (relative to the workspace folder or absolute path) and with a lot of other setting. Details: [below](#catch2TestExplorer.executables) |
| `catch2TestExplorer.defaultCwd` | The working directory where the test is run (relative to the workspace folder or absolue path), if it isn't provided in "executables". (Resolves: \${workspaceFolder}) |
| `catch2TestExplorer.defaultEnv` | Default environment variables to be set when running the tests, if it isn't provided in 'executables'. (Resolves: \${workspaceFolder}) |
| `catch2TestExplorer.debugConfigTemplate` | Set the necessary debug configuraitons and the debug button will work. Details: [below](#catch2TestExplorer.debugConfigTemplate) |
| `catch2TestExplorer.debugBreakOnFailure` | Debugger breaks on failure while debugging the test. This is a Catch2 parameter: --break |
| `catch2TestExplorer.defaultNoThrow` | Skips all assertions that test that an exception is thrown, e.g. REQUIRE_THROWS. This is a Catch2 parameter: --nothrow |
| `catch2TestExplorer.defaultRngSeed` | Specify a seed for the Random Number Generator. For details see [Catch2 documentation](https://github.com/catchorg/Catch2/blob/master/docs/command-line.md#rng-seed) |
| `catch2TestExplorer.defaultWatchTimeoutSec` | Test executables are being watched. In case of one compiles too much this variable can help with it. Unit: second. |
| `catch2TestExplorer.enableSourceDecoration` | Sets the source code decorations: Errored lines will be highlited. |
| `catch2TestExplorer.workerMaxNumber` | The variable maximize the number of the parallel test execution. |
| `testExplorer.onStart` | (This is part of the [dependency extension](https://github.com/hbenl/vscode-test-explorer#configuration)'s settings.) |
| `testExplorer.onReload` | (This is part of the [dependency extension](https://github.com/hbenl/vscode-test-explorer#configuration)'s settings.) |
| Property | Description |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `catch2TestExplorer.executables` | The location of your test executables (relative to the workspace folder or absolute path) and with a lot of other setting. Details: [below](#catch2TestExplorer.executables) |
| `catch2TestExplorer.defaultCwd` | The working directory where the test is run (relative to the workspace folder or absolue path), if it isn't provided in "executables". (Resolves: \${workspaceFolder}) |
| `catch2TestExplorer.defaultEnv` | Default environment variables to be set when running the tests, if it isn't provided in 'executables'. (Resolves: \${workspaceFolder}) |
| `catch2TestExplorer.debugConfigTemplate` | Set the necessary debug configuraitons and the debug button will work. Details: [below](#catch2TestExplorer.debugConfigTemplate) |
| `catch2TestExplorer.debugBreakOnFailure` | Debugger breaks on failure while debugging the test. This is a Catch2 parameter: --break |
| `catch2TestExplorer.defaultNoThrow` | Skips all assertions that test that an exception is thrown, e.g. REQUIRE_THROWS. This is a Catch2 parameter: --nothrow |
| `catch2TestExplorer.defaultRngSeed` | Specify a seed for the Random Number Generator. For details see [Catch2 documentation](https://github.com/catchorg/Catch2/blob/master/docs/command-line.md#rng-seed) |
| `catch2TestExplorer.defaultWatchTimeoutSec` | Test executables are being watched. In case of one compiles too much this variable can help with it. Unit: second. |
| `catch2TestExplorer.defaultRunningTimeoutSec` | Test executable is running in a process. In case of an inifinite loop, it will run forever, unless this parameter is set. |
| `catch2TestExplorer.enableSourceDecoration` | Sets the source code decorations: Errored lines will be highlited. |
| `catch2TestExplorer.workerMaxNumber` | The variable maximize the number of the parallel test execution. |
| `testExplorer.onStart` | (This is part of the [dependency extension](https://github.com/hbenl/vscode-test-explorer#configuration)'s settings.) |
| `testExplorer.onReload` | (This is part of the [dependency extension](https://github.com/hbenl/vscode-test-explorer#configuration)'s settings.) |

### catch2TestExplorer.executables

Expand Down Expand Up @@ -141,7 +142,7 @@ Example:
## Known issues

- (2018-09-03) On windows the navigate to source button isn't working. It is a framework bug.
- (2018-11-17) Long (>80 character) filename, test-name or description can cause test-list parsing failures. Workaround: `#define CATCH_CONFIG_CONSOLE_WIDTH 9999`
- (2018-11-17) Long (>80 character) filename, test-name or description can cause test-list parsing failures. Workaround: `#define CATCH_CONFIG_CONSOLE_WIDTH 300`

## TODOs

Expand Down
72 changes: 32 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "resources/icon.png",
"author": "Mate Pek",
"publisher": "matepek",
"version": "2.2.6",
"version": "2.3.0",
"license": "Unlicense",
"homepage": "https://github.com/matepek/vscode-catch2-test-adapter",
"repository": {
Expand Down Expand Up @@ -55,14 +55,14 @@
"@types/entities": "^1.1.0",
"@types/fs-extra": "^5.0.4",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.12",
"@types/node": "^10.12.15",
"@types/request-promise": "4.1.42",
"@types/sinon": "^5.0.7",
"@types/xml2js": "^0.4.3",
"deep-equal": "^1.0.1",
"fs-extra": "^7.0.1",
"request-promise": "4.2.2",
"sinon": "^7.1.1",
"sinon": "^7.2.2",
"typescript": "^3.2.2",
"vsce": "^1.53.2",
"vscode": "^1.1.26"
Expand Down Expand Up @@ -129,6 +129,15 @@
"default": 10,
"scope": "resource"
},
"catch2TestExplorer.defaultRunningTimeoutSec": {
"description": "Test executable is running in a process. In case of an inifinite loop, it will run forever, unless this parameter is set.",
"type": [
"null",
"number"
],
"default": null,
"scope": "resource"
},
"catch2TestExplorer.workerMaxNumber": {
"description": "The variable maximize the number of the parallel test execution.",
"type": "number",
Expand Down
3 changes: 2 additions & 1 deletion src/C2AllTestSuiteInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ export class C2AllTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {
vscode.EventEmitter<TestLoadStartedEvent | TestLoadFinishedEvent>,
public readonly testStatesEmitter:
vscode.EventEmitter<TestRunStartedEvent | TestRunFinishedEvent |
TestSuiteEvent | TestEvent>,
TestSuiteEvent | TestEvent>,
public readonly autorunEmitter: vscode.EventEmitter<void>,
public readonly variableToValue: [string, string][],
public isEnabledSourceDecoration: boolean,
public rngSeed: string | number | null,
public execWatchTimeout: number,
public execRunningTimeout: null | number,
public isNoThrow: boolean,
) {
this.label = workspaceFolder.name + ' - Catch2';
Expand Down
14 changes: 14 additions & 0 deletions src/C2TestAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
this._allTests.execWatchTimeout =
this._getDefaultExecWatchTimeout(this._getConfiguration());
}
if (configChange.affectsConfiguration(
'catch2TestExplorer.defaultRunningTimeoutSec',
this._workspaceFolder.uri)) {
this._allTests.execRunningTimeout =
this._getDefaultExecRunningTimeout(this._getConfiguration());
}
if (configChange.affectsConfiguration(
'catch2TestExplorer.defaultNoThrow',
this._workspaceFolder.uri)) {
Expand All @@ -104,6 +110,7 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
this._getEnableSourceDecoration(config),
this._getDefaultRngSeed(config),
this._getDefaultExecWatchTimeout(config),
this._getDefaultExecRunningTimeout(config),
this._getDefaultNoThrow(config));
}

Expand Down Expand Up @@ -142,6 +149,7 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
this._getEnableSourceDecoration(config),
this._getDefaultRngSeed(config),
this._getDefaultExecWatchTimeout(config),
this._getDefaultExecRunningTimeout(config),
this._getDefaultNoThrow(config));

this._testsEmitter.fire(<TestLoadStartedEvent>{ type: 'started' });
Expand Down Expand Up @@ -345,6 +353,12 @@ export class C2TestAdapter implements TestAdapter, vscode.Disposable {
return config.get<number>('defaultWatchTimeoutSec', 10) * 1000;
}

private _getDefaultExecRunningTimeout(config: vscode.WorkspaceConfiguration):
null | number {
const r = config.get<null | number>('defaultRunningTimeoutSec', null);
return r !== null ? r * 1000 : r;
}

private _getGlobalAndDefaultEnvironmentVariables(
config: vscode.WorkspaceConfiguration): { [prop: string]: string | undefined } {
const processEnv = process.env;
Expand Down
Loading

0 comments on commit 9a06bce

Please sign in to comment.