Skip to content

Commit

Permalink
Merge pull request #129 from currents-dev/fix/remove-unncessary-prope…
Browse files Browse the repository at this point in the history
…rties

[CSR-1912] fix: removed workerIndex, parallelIndex from attempt and cliArgs from…
  • Loading branch information
miguelangaranocurrents authored Jan 10, 2025
2 parents 9e6324e + eac97e4 commit b4a4922
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ exports[`getInstanceMap > matches snapshot for Test Suite 1 1`] = `
"duration": 3000,
"error": undefined,
"errors": [],
"parallelIndex": 1,
"startTime": "2024-12-20T22:12:47.937Z",
"status": "passed",
"stderr": [],
"stdout": [],
"steps": [],
"workerIndex": 1,
},
],
"expectedStatus": "passed",
Expand Down Expand Up @@ -60,13 +58,11 @@ exports[`getInstanceMap > matches snapshot for Test Suite 1 1`] = `
"duration": 7000,
"error": undefined,
"errors": [],
"parallelIndex": 1,
"startTime": "2024-12-20T22:12:47.937Z",
"status": "passed",
"stderr": [],
"stdout": [],
"steps": [],
"workerIndex": 1,
},
],
"expectedStatus": "passed",
Expand All @@ -89,10 +85,6 @@ exports[`getInstanceMap > matches snapshot for Test Suite 1 1`] = `
},
"spec": "Test Suite 1",
"startTime": "2024-12-20T22:12:47.937Z",
"worker": {
"parallelIndex": 1,
"workerIndex": 1,
},
}
`;

Expand Down Expand Up @@ -122,13 +114,11 @@ exports[`getInstanceMap > matches snapshot for Test Suite 2 1`] = `
"duration": 12000,
"error": undefined,
"errors": [],
"parallelIndex": 1,
"startTime": "2024-12-20T22:12:57.937Z",
"status": "passed",
"stderr": [],
"stdout": [],
"steps": [],
"workerIndex": 1,
},
],
"expectedStatus": "passed",
Expand Down Expand Up @@ -156,13 +146,11 @@ exports[`getInstanceMap > matches snapshot for Test Suite 2 1`] = `
"duration": 30000,
"error": undefined,
"errors": [],
"parallelIndex": 1,
"startTime": "2024-12-20T22:12:57.937Z",
"status": "passed",
"stderr": [],
"stdout": [],
"steps": [],
"workerIndex": 1,
},
],
"expectedStatus": "passed",
Expand All @@ -185,9 +173,5 @@ exports[`getInstanceMap > matches snapshot for Test Suite 2 1`] = `
},
"spec": "Test Suite 2",
"startTime": "2024-12-20T22:12:57.937Z",
"worker": {
"parallelIndex": 1,
"workerIndex": 1,
},
}
`;
10 changes: 0 additions & 10 deletions packages/cmd/src/services/convert/__tests__/fixtures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { TestCase, TestSuite } from '../../types';
export const mockDate = new Date('2024-12-28T12:00:00Z');
export const time = 5000;
export const location = { line: 1, column: 1 };
export const workerIndex = 1;
export const parallelIndex = 1;

export const testCaseWithFailure: TestCase = {
name: 'Test with failure',
Expand Down Expand Up @@ -36,8 +34,6 @@ export const instanceReportTestWithFailure: InstanceReportTest = {
{
_s: 'failed',
attempt: 0,
workerIndex,
parallelIndex,
startTime: new Date('2024-12-28T12:00:05Z').toISOString(),
steps: [],
duration: time,
Expand Down Expand Up @@ -89,8 +85,6 @@ export const instanceReportTestWithoutFailure: InstanceReportTest = {
{
_s: 'passed',
attempt: 0,
workerIndex,
parallelIndex,
startTime: mockDate.toISOString(),
steps: [],
duration: time,
Expand Down Expand Up @@ -131,8 +125,6 @@ export const instanceReportTestNoTimestamp: InstanceReportTest = {
{
_s: 'passed',
attempt: 0,
workerIndex,
parallelIndex,
startTime: mockDate.toISOString(),
steps: [],
duration: time,
Expand Down Expand Up @@ -173,8 +165,6 @@ export const instanceReportTestNoTime: InstanceReportTest = {
{
_s: 'passed',
attempt: 0,
workerIndex: 1,
parallelIndex: 1,
startTime: mockDate.toISOString(),
steps: [],
duration: 0,
Expand Down
2 changes: 0 additions & 2 deletions packages/cmd/src/services/convert/__tests__/instances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ describe('createSuiteJson', () => {
).toBeCloseTo(expectedEndTime, -3);
expect(suiteJson.groupId).toBe(groupId);
expect(suiteJson.spec).toBe(spec);
expect(suiteJson.worker.workerIndex).toBe(1);
expect(suiteJson.worker.parallelIndex).toBe(1);
expect(suiteJson.results.stats.failures).toBe(1);
},
],
Expand Down
1 change: 0 additions & 1 deletion packages/cmd/src/services/convert/getReportConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export function getReportConfig(config: ConvertCommandConfig): ReportConfig {
return {
framework: config.inputFormat,
frameworkVersion: config.frameworkVersion ?? null,
cliArgs: {},
frameworkConfig: {
originFramework: config.framework,
originFrameworkVersion: config.frameworkVersion,
Expand Down
4 changes: 0 additions & 4 deletions packages/cmd/src/services/convert/postman/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ export function createSuiteJson(
const suiteJson: InstanceReport = {
groupId,
spec: suiteName,
worker: {
workerIndex: 1,
parallelIndex: 1,
},
startTime,
results: {
stats: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cmd/src/services/convert/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type ReportConfig = {
framework: string;
frameworkVersion: string | null;
cliArgs: Record<string, unknown>;
cliArgs?: Record<string, unknown>;
frameworkConfig: Record<string, unknown>;
};

Expand Down
4 changes: 0 additions & 4 deletions packages/cmd/src/services/convert/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ function getTestAttempts(
{
_s: 'passed',
attempt: 0,
workerIndex: 1,
parallelIndex: 1,
startTime: suiteTimestamp,
steps: [],
duration: testCaseTime,
Expand All @@ -139,8 +137,6 @@ function getTestAttempts(
attempts.push({
_s: 'failed' as TestCaseStatus,
attempt: index,
workerIndex: 1,
parallelIndex: 1,
startTime: getTestStartTime(time, suiteTimestamp),
steps: [],
duration: testCaseTime,
Expand Down
8 changes: 0 additions & 8 deletions packages/cmd/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,9 @@ export type LocationSchema = {
file: string;
};

export type WorkerInfo = {
workerIndex: number;
parallelIndex: number;
};

export type InstanceReportTestAttempt = {
_s: TestCaseStatus;
attempt: number;
workerIndex: number;
parallelIndex: number;

startTime: string;
steps: unknown[];
Expand Down Expand Up @@ -78,7 +71,6 @@ export type InstanceReportTest = {
export type InstanceReport = {
groupId: string;
spec: string;
worker: WorkerInfo;
startTime: string;
results: {
error?: string;
Expand Down
9 changes: 0 additions & 9 deletions packages/jest/src/lib/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ export function getTestCaseId(
return shortenedHash;
}

export function getWorker() {
const workerIndex = +(process.env.JEST_WORKER_ID || 1);

return {
workerIndex,
parallelIndex: workerIndex,
};
}

export function getTestCaseStatus(
testStatus: JestTestCaseStatus
): TestCaseStatus {
Expand Down
14 changes: 1 addition & 13 deletions packages/jest/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,20 @@ import {
getTestCaseId,
getTestCaseStatus,
getTestRunnerStatus,
getWorker,
isTestFlaky,
jestStatusFromInvocations,
testToSpecName,
writeFileAsync,
} from './lib';
import { getReportConfig } from './lib/getReportConfig';
import { info } from './logger';
import { InstanceReport, JestTestCaseStatus, WorkerInfo } from './types';
import { InstanceReport, JestTestCaseStatus } from './types';

type TestCase = {
id: string;
timestamps: number[];
title: string[];
result: TestCaseResult[];
worker: WorkerInfo;
config: Test['context']['config'];
location?: {
column?: number;
Expand All @@ -54,7 +52,6 @@ type SpecInfo = {
specName: string;
testCaseList: Record<string, TestCase>;
specResult: TestResult | null;
worker: WorkerInfo;
};

type ReporterOptions = {
Expand Down Expand Up @@ -125,7 +122,6 @@ export default class CustomReporter implements Reporter {
specName,
testCaseList: {},
specResult: null,
worker: getWorker(),
};

this.specInfoDeferred[specKey] = new Deferred<void>();
Expand Down Expand Up @@ -153,7 +149,6 @@ export default class CustomReporter implements Reporter {
specName,
testCaseList: {},
specResult: null,
worker: getWorker(),
};

this.specInfoDeferred[specKey] = new Deferred<void>();
Expand All @@ -168,7 +163,6 @@ export default class CustomReporter implements Reporter {
timestamps: [testCaseStartInfo.startedAt ?? new Date().getTime()],
title: getTestCaseFullTitle(testCaseStartInfo),
result: [],
worker: getWorker(),
config: test.context.config,
};

Expand Down Expand Up @@ -214,7 +208,6 @@ export default class CustomReporter implements Reporter {
timestamps: [],
title: getTestCaseFullTitle(testCaseResult),
result: [],
worker: getWorker(),
config: test.context.config,
location: testCaseResult.location,
};
Expand Down Expand Up @@ -258,7 +251,6 @@ export default class CustomReporter implements Reporter {
timestamps: [],
title: getTestCaseFullTitle(testCaseResult),
result: [testCaseResult],
worker: getWorker(),
config: test.context.config,
location: testCaseResult.location,
};
Expand Down Expand Up @@ -319,9 +311,6 @@ export default class CustomReporter implements Reporter {
_s: getTestCaseStatus(result.status as JestTestCaseStatus),
attempt: getAttemptNumber(result),

workerIndex: testCase.worker.workerIndex,
parallelIndex: testCase.worker.parallelIndex,

startTime:
testCase.timestamps.length && testCase.timestamps[index]
? new Date(testCase.timestamps[index]).toISOString()
Expand Down Expand Up @@ -350,7 +339,6 @@ export default class CustomReporter implements Reporter {
const result: InstanceReport = {
groupId: this.specInfo[specKey].projectId,
spec: this.specInfo[specKey].specName,
worker: this.specInfo[specKey].worker,
startTime,
results: {
stats: {
Expand Down
8 changes: 0 additions & 8 deletions packages/jest/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,9 @@ export type LocationSchema = {
file: string;
};

export type WorkerInfo = {
workerIndex: number;
parallelIndex: number;
};

export type InstanceReportTestAttempt = {
_s: TestCaseStatus;
attempt: number;
workerIndex: number;
parallelIndex: number;

startTime: string;
steps: unknown[];
Expand Down Expand Up @@ -78,7 +71,6 @@ export type InstanceReportTest = {
export type InstanceReport = {
groupId: string;
spec: string;
worker: WorkerInfo;
startTime: string;
results: {
error?: string;
Expand Down

0 comments on commit b4a4922

Please sign in to comment.