diff --git a/CHANGELOG.md b/CHANGELOG.md index 73baf741..f2629396 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.3.22] + +### Changed + +- the test list parser timeout from 5 to 30 seconds. + +### Added + +- section picker for debugging. + +### Fixed + +- a bug related to env variables in case of debugging. + ## [2.3.21] - 2019-02-26 ### Added - `testExplorer.sort`, so I removed my logic. If you want the old ordering set this to `byLabelWithSuitesFirst`. -- tooltip: it will show more info about the suites and tests +- tooltip: it will show more info about the suites and tests. ## [2.3.20] - 2019-02-22 diff --git a/package-lock.json b/package-lock.json index 0721aa8a..ae7e5eb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vscode-catch2-test-adapter", - "version": "2.3.20", + "version": "2.3.21", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -43,9 +43,9 @@ } }, "@sinonjs/samsam": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.1.1.tgz", - "integrity": "sha512-ILlwvQUwAiaVBzr3qz8oT1moM7AIUHqUc2UmEjQcH9lLe+E+BZPwUMuc9FFojMswRK4r96x5zDTTrowMLw/vuA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.2.0.tgz", + "integrity": "sha512-j5F1rScewLtx6pbTK0UAjA3jJj4RYiSKOix53YWv+Jzy/AZ69qHxUpU8fwVLjyKbEEud9QrLpv6Ggs7WqTimYw==", "dev": true, "requires": { "@sinonjs/commons": "^1.0.2", @@ -926,9 +926,9 @@ } }, "eslint-config-prettier": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.0.0.tgz", - "integrity": "sha512-kWuiJxzV5NwOwZcpyozTzDT5KJhBw292bbYro9Is7BWnbNMg15Gmpluc1CTetiCatF8DRkNvgPAOaSyg+bYr3g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-4.1.0.tgz", + "integrity": "sha512-zILwX9/Ocz4SV2vX7ox85AsrAgXV3f2o2gpIicdMIOra48WYqgUnWNH/cR/iHtmD2Vb3dLSC3LiEJnS05Gkw7w==", "dev": true, "requires": { "get-stdin": "^6.0.0" @@ -2756,14 +2756,14 @@ "dev": true }, "sinon": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.2.4.tgz", - "integrity": "sha512-FGlcfrkiBRfaEIKRw8s/9mk4nP4AMGswvKFixLo+AzsOhskjaBCHAHGLMd8pCJpQGS+9ZI71px6qoQUyvADeyA==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.2.5.tgz", + "integrity": "sha512-1c2KK6g5NQr9XNYCEcUbeFtBpKZD1FXEw0VX7gNhWUBtkchguT2lNdS7XmS7y64OpQWfSNeeV/f8py3NNcQ63Q==", "dev": true, "requires": { "@sinonjs/commons": "^1.3.0", "@sinonjs/formatio": "^3.1.0", - "@sinonjs/samsam": "^3.1.1", + "@sinonjs/samsam": "^3.2.0", "diff": "^3.5.0", "lolex": "^3.1.0", "nise": "^1.4.10", diff --git a/package.json b/package.json index 61944c64..5b8d0a72 100644 --- a/package.json +++ b/package.json @@ -66,13 +66,13 @@ "@typescript-eslint/parser": "^1.4.2", "deep-equal": "^1.0.1", "eslint": "^5.14.1", - "eslint-config-prettier": "^4.0.0", + "eslint-config-prettier": "^4.1.0", "eslint-plugin-prettier": "^3.0.1", "fs-extra": "^7.0.1", "mocha-eslint": "^5.0.0", "prettier": "^1.16.4", "request-promise": "4.2.2", - "sinon": "^7.2.4", + "sinon": "^7.2.5", "typescript": "^3.3.3333", "vsce": "^1.57.1", "vscode": "^1.1.30" diff --git a/src/Catch2TestInfo.ts b/src/Catch2TestInfo.ts index 1c33e3da..cb1eed86 100644 --- a/src/Catch2TestInfo.ts +++ b/src/Catch2TestInfo.ts @@ -16,6 +16,20 @@ interface XmlObject { [prop: string]: any; //eslint-disable-line } +export class Catch2Section { + public constructor(name: string, filename: string, line: number) { + this.name = name; + this.filename = filename; + this.line = line; + } + + public readonly name: string; + public readonly filename: string; + public readonly line: number; + public readonly children: Catch2Section[] = []; + public failed: boolean = false; +} + export class Catch2TestInfo extends AbstractTestInfo { public constructor( shared: SharedVariables, @@ -27,6 +41,7 @@ export class Catch2TestInfo extends AbstractTestInfo { line: number, execPath: string, execOptions: SpawnOptions, + sections?: Catch2Section[], ) { super( shared, @@ -41,6 +56,13 @@ export class Catch2TestInfo extends AbstractTestInfo { execPath, execOptions, ); + this._sections = sections; + } + + private _sections: undefined | Catch2Section[]; + + public get sections(): undefined | Catch2Section[] { + return this._sections; } public getEscapedTestName(): string { @@ -89,19 +111,21 @@ export class Catch2TestInfo extends AbstractTestInfo { } private _processXmlTagTestCaseInner(testCase: XmlObject, testEvent: TestEvent): void { - const title = '⬇️⬇️⬇️ "' + testCase.$.name + '" at line ' + testCase.$.line; + const title: Catch2Section = new Catch2Section(testCase.$.name, testCase.$.filename, testCase.$.line); if (testCase.OverallResult[0].$.hasOwnProperty('durationInSeconds')) { testEvent.message += '⏱ Duration: ' + testCase.OverallResult[0].$.durationInSeconds + ' second(s).\n'; } - this._processInfoWarningAndFailureTags(testCase, title, testEvent); + this._processInfoWarningAndFailureTags(testCase, title, [], testEvent); + + this._processXmlTagExpressions(testCase, title, [], testEvent); - this._processXmlTagExpressions(testCase, title, testEvent); + this._processXmlTagSections(testCase, title, [], testEvent, title); - this._processXmlTagSections(testCase, title, testEvent); + this._sections = title.children; - this._processXmlTagFatalErrorConditions(testCase, title, testEvent); + this._processXmlTagFatalErrorConditions(testCase, title, [], testEvent); if (testCase.OverallResult[0].hasOwnProperty('StdOut')) { testEvent.message += '⬇️⬇️⬇️ std::cout:'; @@ -126,7 +150,12 @@ export class Catch2TestInfo extends AbstractTestInfo { } } - private _processInfoWarningAndFailureTags(xml: XmlObject, title: string, testEvent: TestEvent): void { + private _processInfoWarningAndFailureTags( + xml: XmlObject, + title: Catch2Section, + stack: Catch2Section[], + testEvent: TestEvent, + ): void { if (xml.hasOwnProperty('Info')) { for (let j = 0; j < xml.Info.length; ++j) { const info = xml.Info[j]; @@ -156,22 +185,25 @@ export class Catch2TestInfo extends AbstractTestInfo { } } - private _processXmlTagExpressions(xml: XmlObject, title: string, testEvent: TestEvent): void { + private _processXmlTagExpressions( + xml: XmlObject, + title: Catch2Section, + stack: Catch2Section[], + testEvent: TestEvent, + ): void { if (xml.hasOwnProperty('Expression')) { for (let j = 0; j < xml.Expression.length; ++j) { const expr = xml.Expression[j]; try { testEvent.message += - title + - ' ➡️ ' + - (expr.$.type ? expr.$.type : '') + - ' at line ' + - expr.$.line + - ':\n' + - ' Original:\n ' + + this._getTitle( + title, + stack, + new Catch2Section(expr.$.type ? expr.$.type : '', expr.$.filename, expr.$.line), + ) + + ':\n Original:\n ' + expr.Original.map((x: string) => x.trim()).join('; ') + - '\n' + - ' Expanded:\n ' + + '\n Expanded:\n ' + expr.Expanded.map((x: string) => x.trim()).join('; ') + '\n' + '⬆️⬆️⬆️\n\n'; @@ -182,23 +214,46 @@ export class Catch2TestInfo extends AbstractTestInfo { } catch (error) { this._shared.log.error(error); } - this._processXmlTagFatalErrorConditions(expr, title, testEvent); + this._processXmlTagFatalErrorConditions(expr, title, stack, testEvent); } } } - private _processXmlTagSections(xml: XmlObject, title: string, testEvent: TestEvent): void { + private _processXmlTagSections( + xml: XmlObject, + title: Catch2Section, + stack: Catch2Section[], + testEvent: TestEvent, + parentSection: Catch2Section, + ): void { if (xml.hasOwnProperty('Section')) { for (let j = 0; j < xml.Section.length; ++j) { const section = xml.Section[j]; try { - title += ' ➡️ "' + section.$.name + '" at line ' + section.$.line; + let currSection = parentSection.children.find( + v => v.name === section.$.name && v.filename === section.$.filename && v.line === section.$.line, + ); - this._processInfoWarningAndFailureTags(xml, title, testEvent); + if (currSection === undefined) { + currSection = new Catch2Section(section.$.name, section.$.filename, section.$.line); + parentSection.children.push(currSection); + } - this._processXmlTagExpressions(section, title, testEvent); + if ( + section.OverallResults && + section.OverallResults.length > 0 && + section.OverallResults[0].$.failures !== '0' + ) { + currSection.failed = true; + } + + const currStack = stack.concat(currSection); + + this._processInfoWarningAndFailureTags(xml, title, currStack, testEvent); - this._processXmlTagSections(section, title, testEvent); + this._processXmlTagExpressions(section, title, currStack, testEvent); + + this._processXmlTagSections(section, title, currStack, testEvent, currSection); } catch (error) { this._shared.log.error(error); } @@ -206,13 +261,19 @@ export class Catch2TestInfo extends AbstractTestInfo { } } - private _processXmlTagFatalErrorConditions(expr: XmlObject, title: string, testEvent: TestEvent): void { + private _processXmlTagFatalErrorConditions( + expr: XmlObject, + title: Catch2Section, + stack: Catch2Section[], + testEvent: TestEvent, + ): void { if (expr.hasOwnProperty('FatalErrorCondition')) { try { for (let j = 0; j < expr.FatalErrorCondition.length; ++j) { const fatal = expr.FatalErrorCondition[j]; - testEvent.message += title + ' ➡️ Fatal Error at line ' + expr.$.line + ':\n'; + testEvent.message += + this._getTitle(title, stack, new Catch2Section('Fatal Error', expr.$.filename, expr.$.line)) + ':\n'; if (fatal.hasOwnProperty('_')) { testEvent.message += ' Error: ' + fatal._.trim() + '\n'; } else { @@ -226,4 +287,30 @@ export class Catch2TestInfo extends AbstractTestInfo { } } } + + private _getTitle(title: Catch2Section, stack: Catch2Section[], suffix: Catch2Section): string { + return ( + '⬇️⬇️⬇️ ' + + [title] + .concat(stack, suffix) + .map((f: Catch2Section) => '"' + f.name + '" at line ' + f.line) + .join(' ➡️ ') + ); + } + + // private _getExecParamStr(stack: Section[]): string { + // return ( + // '{ "exec": ' + + // this.execPath + + // '",\n' + + // ' "cwd": "' + + // this.execOptions.cwd + + // '"\n' + + // ' "args": ["' + + // this.getEscapedTestName().replace('"', '\\"') + + // '"' + + // stack.map(f => ', "-c", "' + f.name.replace('"', '\\"') + '"').join('') + + // '] }' + // ); + // } } diff --git a/src/Catch2TestSuiteInfo.ts b/src/Catch2TestSuiteInfo.ts index 0f68a4a1..a83cf9a2 100644 --- a/src/Catch2TestSuiteInfo.ts +++ b/src/Catch2TestSuiteInfo.ts @@ -49,7 +49,7 @@ export class Catch2TestSuiteInfo extends AbstractTestSuiteInfo { this.execPath, ['[.],*', '--verbosity', 'high', '--list-tests', '--use-colour', 'no'], this.execOptions, - 5000, + 30000, ) .then(catch2TestListOutput => { const oldChildren = this.children; @@ -58,13 +58,18 @@ export class Catch2TestSuiteInfo extends AbstractTestSuiteInfo { if (catch2TestListOutput.stderr) { this._shared.log.warn('reloadChildren -> catch2TestListOutput.stderr: ', catch2TestListOutput); - const test = this._createCatch2TestInfo( - undefined, - '⚠️ Check the test output message for details ⚠️', - '', - [], - '', - 0, + const test = this.addChild( + new Catch2TestInfo( + this._shared, + undefined, + 'Check the test output message for details ⚠️', + '', + [], + '', + 0, + this.execPath, + this.execOptions, + ), ); this._shared.sendTestEventEmitter.fire([ { type: 'test', test: test, state: 'errored', message: catch2TestListOutput.stderr }, @@ -85,20 +90,29 @@ export class Catch2TestSuiteInfo extends AbstractTestSuiteInfo { if (lines[i].startsWith(' ')) { this._shared.log.warn('Probably too long test name: ' + lines); this.children = []; - const test = this._createCatch2TestInfo( - undefined, - '⚠️ Check the test output message for details ⚠️', - '', - [], - '', - 0, + const test = this.addChild( + new Catch2TestInfo( + this._shared, + undefined, + 'Check the test output message for details ⚠️', + '', + [], + '', + 0, + this.execPath, + this.execOptions, + ), ); this._shared.sendTestEventEmitter.fire([ { type: 'test', test: test, state: 'errored', - message: '⚠️ Probably too long test name!\n🛠 Try to define: #define CATCH_CONFIG_CONSOLE_WIDTH 300)', + message: [ + '⚠️ Probably too long test name or the test name starts with space characters!', + '🛠 - Try to define: #define CATCH_CONFIG_CONSOLE_WIDTH 300)', + '🛠 - Remove whitespace characters from the beggining of test "' + lines[i].substr(2) + '"', + ].join('\n'), }, ]); return; @@ -130,43 +144,25 @@ export class Catch2TestSuiteInfo extends AbstractTestSuiteInfo { } const index = oldChildren.findIndex(c => c.testNameFull == testNameFull); - this._createCatch2TestInfo( - index != -1 ? oldChildren[index].id : undefined, - testNameFull, - description, - tags, - filePath, - line - 1, + + this.addChild( + new Catch2TestInfo( + this._shared, + index != -1 ? oldChildren[index].id : undefined, + testNameFull, + description, + tags, + filePath, + line - 1, + this.execPath, + this.execOptions, + index != -1 ? oldChildren[index].sections : undefined, + ), ); } }); } - private _createCatch2TestInfo( - id: string | undefined, - testName: string, - description: string, - tags: string[], - file: string, - line: number, - ): Catch2TestInfo { - const test = new Catch2TestInfo( - this._shared, - id, - testName, - description, - tags, - file, - line, - this.execPath, - this.execOptions, - ); - - this.addChild(test); - - return test; - } - protected _getRunParams(childrenToRun: 'runAllTestsExceptSkipped' | Set): string[] { const execParams: string[] = []; @@ -398,7 +394,8 @@ export class Catch2TestSuiteInfo extends AbstractTestSuiteInfo { }); } - public addChild(test: Catch2TestInfo): void { + public addChild(test: Catch2TestInfo): Catch2TestInfo { super.addChild(test); + return test; } } diff --git a/src/GoogleTestSuiteInfo.ts b/src/GoogleTestSuiteInfo.ts index 0fdfa53e..2139d112 100644 --- a/src/GoogleTestSuiteInfo.ts +++ b/src/GoogleTestSuiteInfo.ts @@ -48,7 +48,7 @@ export class GoogleTestSuiteInfo extends AbstractTestSuiteInfo { private _reloadGoogleTests(): Promise { const tmpFilePath = (this.execOptions.cwd || '.') + '/tmp_gtest_output_' + Math.random().toString(36) + '.xml.tmp'; return c2fs - .spawnAsync(this.execPath, ['--gtest_list_tests', '--gtest_output=xml:' + tmpFilePath], this.execOptions, 5000) + .spawnAsync(this.execPath, ['--gtest_list_tests', '--gtest_output=xml:' + tmpFilePath], this.execOptions, 30000) .then(googleTestListOutput => { const oldChildren = this.children; this.children = []; @@ -60,7 +60,7 @@ export class GoogleTestSuiteInfo extends AbstractTestSuiteInfo { this._shared, undefined, '', - '⚠️ Check the test output message for details ⚠️', + 'Check the test output message for details ⚠️', '', undefined, undefined, diff --git a/src/TestAdapter.ts b/src/TestAdapter.ts index 6e086eec..7fd3d68c 100644 --- a/src/TestAdapter.ts +++ b/src/TestAdapter.ts @@ -23,6 +23,7 @@ import { TaskQueue } from './TaskQueue'; import { TestExecutableInfo } from './TestExecutableInfo'; import { SharedVariables } from './SharedVariables'; import { AbstractTestInfo } from './AbstractTestInfo'; +import { Catch2Section, Catch2TestInfo } from './Catch2TestInfo'; export class TestAdapter implements api.TestAdapter, vscode.Disposable { private readonly _log: util.Log; @@ -280,7 +281,7 @@ export class TestAdapter implements api.TestAdapter, vscode.Disposable { }); } - public debug(tests: string[]): Promise { + public async debug(tests: string[]): Promise { if (this._mainTaskQueue.size > 0) { this._log.info(__filename + '. Debug is busy'); throw Error('The adapter is busy. Try it again a bit later.'); @@ -317,6 +318,56 @@ export class TestAdapter implements api.TestAdapter, vscode.Disposable { const argsArray = testInfo.getDebugParams(this._getDebugBreakOnFailure(config)); + if (testInfo instanceof Catch2TestInfo) { + const sections = testInfo.sections; + if (sections && sections.length > 0) { + interface QuickPickItem extends vscode.QuickPickItem { + sectionStack: Catch2Section[]; + } + + const items: QuickPickItem[] = [ + { + label: testInfo.origLabel, + sectionStack: [], + description: 'Select the section combo you wish to debug or choose this to debug all of it.', + }, + ]; + + const traverse = ( + stack: Catch2Section[], + section: Catch2Section, + hasNextStack: boolean[], + hasNext: boolean, + ): void => { + const currStack = stack.concat(section); + const space = '\u3000'; + let label = hasNextStack.map(h => (h ? '┃' : space)).join(''); + label += hasNext ? '┣' : '┗'; + label += section.name; + + items.push({ + label: label, + description: section.failed ? '❌' : '✅', + sectionStack: currStack, + }); + + for (let i = 0; i < section.children.length; ++i) + traverse(currStack, section.children[i], hasNextStack.concat(hasNext), i < section.children.length - 1); + }; + + for (let i = 0; i < sections.length; ++i) traverse([], sections[i], [], i < sections.length - 1); + + const pick = await vscode.window.showQuickPick(items); + + if (pick === undefined) return Promise.resolve(); + + pick.sectionStack.forEach(s => { + argsArray.push('-c'); + argsArray.push(s.name); + }); + } + } + const debugConfig = resolveVariables(template, [ ...this._variableToValue, ['${suitelabel}', suiteLabels], // deprecated @@ -327,7 +378,7 @@ export class TestAdapter implements api.TestAdapter, vscode.Disposable { ['${argsArray}', argsArray], ['${argsStr}', '"' + argsArray.join('" "') + '"'], ['${cwd}', testInfo.execOptions.cwd!], - ['${envObj}', testInfo.execOptions.env!], + ['${envObj}', Object.assign(Object.assign({}, process.env), testInfo.execOptions.env!)], ]); this._log.info('Debug: resolved catch2TestExplorer.debugConfigTemplate:', debugConfig); diff --git a/src/test/TestCatch2Framework.test.ts b/src/test/TestCatch2Framework.test.ts index fde4bbd2..9ff49a27 100644 --- a/src/test/TestCatch2Framework.test.ts +++ b/src/test/TestCatch2Framework.test.ts @@ -175,7 +175,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: adapter.suite1 }, { type: 'finished' }, @@ -219,7 +219,7 @@ describe(path.basename(__filename), function() { assert.equal(suite1.children.length, 1, inspect([testListErrOutput, adapter.testLoadsEvents])); assert.strictEqual(suite1.label, 'execPath1.exe'); - assert.strictEqual(suite1.children[0].label, '⚠️ Check the test output message for details ⚠️'); + assert.strictEqual(suite1.children[0].label, 'Check the test output message for details ⚠️'); await waitFor(this, () => { return adapter!.testStatesEvents.length == 6; diff --git a/src/test/TestCatch2FrameworkLoad.test.ts b/src/test/TestCatch2FrameworkLoad.test.ts index 99150259..6361bcc0 100644 --- a/src/test/TestCatch2FrameworkLoad.test.ts +++ b/src/test/TestCatch2FrameworkLoad.test.ts @@ -162,7 +162,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' }, @@ -194,7 +194,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' }, @@ -365,7 +365,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }; assert.ok(adapter.getTestStatesEventIndex(s1t2running) < adapter.getTestStatesEventIndex(s1t2finished)); assert.ok(adapter.getTestStatesEventIndex(s1t2finished) < adapter.getTestStatesEventIndex(s1finished)); @@ -399,7 +399,7 @@ describe(path.basename(__filename), function() { test: s2t3, decorations: [{ line: 20, message: '⬅️ false' }], message: - '⏱ Duration: 0.000178 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ REQUIRE at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000178 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ "REQUIRE" at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }; assert.ok(adapter.getTestStatesEventIndex(s2t3running) < adapter.getTestStatesEventIndex(s2t3finished)); assert.ok(adapter.getTestStatesEventIndex(s2t3finished) < adapter.getTestStatesEventIndex(s2finished)); @@ -480,7 +480,7 @@ describe(path.basename(__filename), function() { test: s2t3, decorations: [{ line: 20, message: '⬅️ false' }], message: - '⏱ Duration: 0.000596 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ REQUIRE at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000596 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ "REQUIRE" at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite2 }, { type: 'finished' }, @@ -507,7 +507,7 @@ describe(path.basename(__filename), function() { test: s2t3, decorations: [{ line: 20, message: '⬅️ false' }], message: - '⏱ Duration: 0.000596 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ REQUIRE at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000596 second(s).\n⬇️⬇️⬇️ "s2t3" at line 19 ➡️ "REQUIRE" at line 21:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite2 }, { type: 'finished' }, @@ -539,7 +539,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' }, @@ -572,7 +572,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'suite', state: 'running', suite: suite2 }, @@ -620,6 +620,9 @@ describe(path.basename(__filename), function() { // this tests the sinon stubs too await adapter.run([s1t1.id]); + + s1t1 = adapter.get(0, 0) as TestInfo; + assert.deepStrictEqual(adapter.testStatesEvents, [ ...expected, { type: 'started', tests: [s1t1.id] }, @@ -668,6 +671,8 @@ describe(path.basename(__filename), function() { // this tests the sinon stubs too await adapter.run([s1t1.id]); + s1t1 = adapter.get(0, 0) as TestInfo; + assert.deepStrictEqual(adapter.testStatesEvents, [ ...expected, { type: 'started', tests: [s1t1.id] }, @@ -1031,7 +1036,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' }, @@ -1069,7 +1074,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' }, @@ -1207,7 +1212,7 @@ describe(path.basename(__filename), function() { test: s1t2, decorations: [{ line: 14, message: '⬅️ false' }], message: - '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ REQUIRE at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', + '⏱ Duration: 0.000204 second(s).\n⬇️⬇️⬇️ "s1t2" at line 13 ➡️ "REQUIRE" at line 15:\n Original:\n std::false_type::value\n Expanded:\n false\n⬆️⬆️⬆️\n\n', }, { type: 'suite', state: 'completed', suite: suite1 }, { type: 'finished' },