Skip to content

Commit

Permalink
Merge pull request #22 from matepek/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
matepek authored Nov 19, 2018
2 parents 9ebbff3 + 3ce9d4e commit efdf1ad
Show file tree
Hide file tree
Showing 18 changed files with 960 additions and 1,114 deletions.
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
name: Bug report
about: Create a report to help us improve

---

**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 '....'
Expand All @@ -21,8 +21,11 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- Extension Version [e.g. 22]
- VS Code Version [e.g. 22]

- Extension Version [e.g. 22]
- VS Code Version [e.g. 22]
- Catch2 Version
- OS Type and Version

**Additional context**
Add any other context about the problem here.
25 changes: 9 additions & 16 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Deploy",
"program": "${workspaceFolder}/out/repo_scripts/deploy.js",
"cwd": "${workspaceFolder}"
},
{
"type": "extensionHost",
"request": "launch",
"name": "Catch2 adapter",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out"],
"preLaunchTask": "npm: watch"
},
{
"name": "Extension Tests",
"type": "extensionHost",
Expand All @@ -33,6 +17,15 @@
"env": {
"C2AVCVA": "c:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat"
}
},
{
"type": "extensionHost",
"request": "launch",
"name": "Catch2 adapter",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out"],
"preLaunchTask": "npm: watch"
}
]
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
},
"prettier.printWidth": 100,
"prettier.jsxBracketSameLine": true,
"editor.formatOnSave": true
"editor.formatOnSave": true,
"files.associations": {
"*.txt": "cpp"
},
"editor.formatOnSaveTimeout": 1750
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.2]

### Fixed

- A bug related to jumping to source.

## [2.0.1] - 2018-11-07

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Update your settings! ([See changelog](CHANGELOG.md) or [configuration below](#C
[![GitHub license](https://img.shields.io/github/license/matepek/vscode-catch2-test-adapter.svg)](https://github.com/matepek/vscode-catch2-test-adapter/blob/master/LICENSE)
[![Visual Studio Marketplace](https://img.shields.io/vscode-marketplace/d/matepek.vscode-catch2-test-adapter.svg)](https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter)
[![Visual Studio Marketplace](https://img.shields.io/vscode-marketplace/v/matepek.vscode-catch2-test-adapter.svg)](https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter)
[![GitHub stars](https://img.shields.io/github/stars/badges/shields.svg?style=social&label=Stars)](https://github.com/matepek/vscode-catch2-test-adapter)

This extension allows you to run your [Catch2 tests](https://github.com/catchorg/Catch2) using the
[Test Explorer for VS Code](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer).
Expand All @@ -21,8 +22,8 @@ This extension allows you to run your [Catch2 tests](https://github.com/catchorg
| 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.defaultEnv` | Default environment variables to be set when running the tests, if it isn't provided in 'executables'. (Resolves: ${workspaceFolder}) |
| `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.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.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.workerMaxNumber` | The variable maximize the number of the parallel test execution. |
Expand Down Expand Up @@ -138,6 +139,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`

## TODOs

Expand Down
13 changes: 2 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@types/fs-extra": "^5.0.4",
"@types/mocha": "^5.2.5",
"@types/request-promise": "4.1.42",
"@types/sinon": "^5.0.5",
"@types/sinon": "5.0.5",
"@types/xml2js": "^0.4.3",
"deep-equal": "^1.0.1",
"fs-extra": "^7.0.1",
Expand Down Expand Up @@ -145,16 +145,7 @@
"object",
"null"
],
"default": {
"type": "cppdbg",
"MIMode": "lldb",
"program": "${exec}",
"args": "${args}",
"cwd": "${cwd}",
"env": "${envObj}",
"stopAtEntry": false,
"externalConsole": true
},
"default": null,
"scope": "resource"
}
}
Expand Down
30 changes: 20 additions & 10 deletions src/C2AllTestSuiteInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import {SpawnOptions} from 'child_process';
import {inspect} from 'util';
import * as vscode from 'vscode';
import {TestRunFinishedEvent, TestRunStartedEvent, TestSuiteInfo} from 'vscode-test-adapter-api';
import {TestEvent, TestLoadFinishedEvent, TestLoadStartedEvent, TestRunFinishedEvent, TestRunStartedEvent, TestSuiteEvent, TestSuiteInfo} from 'vscode-test-adapter-api';
import * as util from 'vscode-test-adapter-util';

import {C2ExecutableInfo} from './C2ExecutableInfo'
import {C2TestAdapter} from './C2TestAdapter';
import {C2TestInfo} from './C2TestInfo';
import {C2TestSuiteInfo} from './C2TestSuiteInfo';
import {generateUniqueId} from './IdGenerator';
Expand All @@ -21,7 +21,19 @@ export class C2AllTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {
readonly children: C2TestSuiteInfo[] = [];
private readonly _executables: C2ExecutableInfo[] = [];

constructor(private readonly adapter: C2TestAdapter) {
constructor(
public readonly log: util.Log,
public readonly workspaceFolder: vscode.WorkspaceFolder,
public readonly testsEmitter:
vscode.EventEmitter<TestLoadStartedEvent|TestLoadFinishedEvent>,
public readonly testStatesEmitter:
vscode.EventEmitter<TestRunStartedEvent|TestRunFinishedEvent|
TestSuiteEvent|TestEvent>,
public readonly variableToValue: [string, string][],
public isEnabledSourceDecoration: boolean,
public rngSeed: string|number|null,
public execWatchTimeout: number,
) {
this.id = generateUniqueId();
}

Expand Down Expand Up @@ -64,8 +76,7 @@ export class C2AllTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {

createChildSuite(label: string, execPath: string, execOptions: SpawnOptions):
C2TestSuiteInfo {
const suite =
new C2TestSuiteInfo(label, this.adapter, execPath, execOptions);
const suite = new C2TestSuiteInfo(label, this, execPath, execOptions);

let i = this.children.findIndex((v: C2TestSuiteInfo) => {
return suite.label.trim().localeCompare(v.label.trim()) < 0;
Expand All @@ -89,13 +100,13 @@ export class C2AllTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {
await executable.load();
this._executables.push(executable);
} catch (e) {
this.adapter.log.error(inspect([e, i, executables]));
this.log.error(inspect([e, i, executables]));
}
}
}

run(tests: string[], workerMaxNumber: number): Promise<void> {
this.adapter.testStatesEmitter.fire(
this.testStatesEmitter.fire(
<TestRunStartedEvent>{type: 'started', tests: tests});

const taskPool = new TaskPool(workerMaxNumber);
Expand All @@ -117,12 +128,11 @@ export class C2AllTestSuiteInfo implements TestSuiteInfo, vscode.Disposable {
}

if (testSet.size > 0) {
this.adapter.log.error('Some tests have remained.');
this.log.error('Some tests have remained.');
}

const always = () => {
this.adapter.testStatesEmitter.fire(
<TestRunFinishedEvent>{type: 'finished'});
this.testStatesEmitter.fire(<TestRunFinishedEvent>{type: 'finished'});
};

return Promise.all(ps).then(always, always);
Expand Down
Loading

0 comments on commit efdf1ad

Please sign in to comment.