Skip to content

Commit

Permalink
keep test result id with dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Dec 18, 2024
1 parent b143687 commit b492d3b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/PHPUnit/ProblemMatcher/PHPUnitProblemMatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('PHPUnit ProblemMatcher Text', () => {
resultShouldBe(`##teamcity[testStarted name='addition_provider with data set #2' locationHint='php_qn://${phpUnitProjectWin('tests/AssertionsTest.php')}::\\Recca0120\\VSCode\\Tests\\AssertionsTest::addition_provider with data set #2' flowId='8024']`, {
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
file: phpUnitProjectWin('tests/AssertionsTest.php'),
locationHint: `php_qn://${phpUnitProjectWin('tests/AssertionsTest.php')}::\\Recca0120\\VSCode\\Tests\\AssertionsTest::addition_provider with data set #2`,
flowId: 8024,
Expand All @@ -144,7 +144,7 @@ describe('PHPUnit ProblemMatcher Text', () => {
resultShouldBe(`##teamcity[testFinished name='addition_provider with data set #2' duration='0' flowId='8024']`, {
event: TestResultEvent.testFailed,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
file: phpUnitProjectWin('tests/AssertionsTest.php'),
locationHint: `php_qn://${phpUnitProjectWin('tests/AssertionsTest.php')}::\\Recca0120\\VSCode\\Tests\\AssertionsTest::addition_provider with data set #2`,
message: 'Failed asserting that 1 matches expected 2.',
Expand Down
12 changes: 6 additions & 6 deletions src/PHPUnit/ProblemMatcher/PestProblemMatcher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,39 +389,39 @@ describe('Pest ProblemMatcher Text', () => {
resultShouldBe(`##teamcity[testStarted name='Addition provider with data set ""foo-bar_%$"' locationHint='pest_qn://Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"' flowId='53556']`, {
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
name: 'Addition provider with data set ""foo-bar_%$"',
flowId: 53556,
});

resultShouldBe(`##teamcity[testFinished name='Addition provider with data set ""foo-bar_%$"' duration='0' flowId='53556']`, {
event: TestResultEvent.testFinished,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
name: 'Addition provider with data set ""foo-bar_%$"',
flowId: 53556,
});

resultShouldBe(`##teamcity[testStarted name='Addition provider with data set #0' locationHint='pest_qn://Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #0' flowId='53556']`, {
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #0',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #0',
name: 'Addition provider with data set #0',
flowId: 53556,
});

resultShouldBe(`##teamcity[testFinished name='Addition provider with data set #0' duration='0' flowId='53556']`, {
event: TestResultEvent.testFinished,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #0',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #0',
name: 'Addition provider with data set #0',
flowId: 53556,
});

resultShouldBe(`##teamcity[testStarted name='Addition provider with data set #1' locationHint='pest_qn://Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #1' flowId='53556']`, {
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #1',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #1',
name: 'Addition provider with data set #1',
flowId: 53556,
});
Expand All @@ -431,7 +431,7 @@ describe('Pest ProblemMatcher Text', () => {
resultShouldBe(`##teamcity[testFinished name='Addition provider with data set #1' duration='0' flowId='53556']`, {
event: TestResultEvent.testFailed,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #1',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #1',
name: 'Addition provider with data set #1',
flowId: 53556,
});
Expand Down
4 changes: 2 additions & 2 deletions src/PHPUnit/ProblemMatcher/TestResultParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ describe('TestResultParser', () => {
expect(parse(text)).toEqual({
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set #2',
file: phpUnitProjectWin('tests/AssertionsTest.php'),
name: 'addition_provider with data set #2',
locationHint: `php_qn://${phpUnitProjectWin('tests/AssertionsTest.php')}::\\Recca0120\\VSCode\\Tests\\AssertionsTest::addition_provider with data set #2`,
Expand All @@ -421,7 +421,7 @@ describe('TestResultParser', () => {
expect(parse(text)).toEqual({
event: TestResultEvent.testStarted,
id: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider',
testId: 'Assertions (Recca0120\\VSCode\\Tests\\Assertions)::Addition provider with data set ""foo-bar_%$"',
file: phpUnitProjectWin('tests/AssertionsTest.php'),
name: 'addition_provider with data set ""foo-bar_%$"',
locationHint: `php_qn://${phpUnitProjectWin('tests/AssertionsTest.php')}::\\Recca0120\\VSCode\\Tests\\AssertionsTest::addition_provider with data set ""foo-bar_%$"`,
Expand Down
3 changes: 2 additions & 1 deletion src/PHPUnit/TestParser/Transformers/PHPUnitTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export class PHPUnitTransformer extends Transformer {

const type = !methodName ? TestType.class : TestType.method;
const id = this.uniqueId({ type: type, classFQN, methodName });
const testId = this.removeDataset(id);
const testId = id;
// const testId = this.removeDataset(id);

return { id, testId, file };
}
Expand Down
3 changes: 2 additions & 1 deletion src/PHPUnit/TestParser/Transformers/PestTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export class PestTransformer extends PHPUnitTransformer {
const classFQN = matched.groups?.['classFQN'];
const type = !methodName ? TestType.class : TestType.method;
const id = this.uniqueId({ type: type, classFQN, methodName });
const testId = this.removeDataset(id);
const testId = id;
// const testId = this.removeDataset(id);

return { id, testId, file };
}
Expand Down
6 changes: 3 additions & 3 deletions src/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('Extension Test', () => {

let expected;
if (semver.gte(PHPUNIT_VERSION, '10.0.0')) {
expected = { enqueued: 28, started: 35, passed: 23, failed: 10, end: 1 };
expected = { enqueued: 28, started: 28, passed: 18, failed: 8, end: 1 };
} else {
expected = { enqueued: 28, started: 29, passed: 16, failed: 11, end: 1 };
}
Expand All @@ -228,7 +228,7 @@ describe('Extension Test', () => {

let expected;
if (semver.gte(PHPUNIT_VERSION, '10.0.0')) {
expected = { enqueued: 27, started: 34, passed: 23, failed: 9, end: 1 };
expected = { enqueued: 27, started: 27, passed: 18, failed: 7, end: 1 };
} else {
expected = { enqueued: 27, started: 28, passed: 16, failed: 10, end: 1 };
}
Expand All @@ -252,7 +252,7 @@ describe('Extension Test', () => {
'--teamcity',
], expect.objectContaining({ cwd }));

expectTestResultCalled(ctrl, { enqueued: 9, started: 12, passed: 6, failed: 4, end: 1 });
expectTestResultCalled(ctrl, { enqueued: 9, started: 9, passed: 4, failed: 3, end: 1 });
});

it('should run test case', async () => {
Expand Down

0 comments on commit b492d3b

Please sign in to comment.