Skip to content

Commit 4c24aa2

Browse files
rename helper function and remove generic
1 parent 64ff9b4 commit 4c24aa2

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

packages/test/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function cleanStackTrace(ostack: string): string {
105105
* to different stack traces depending on Node version.
106106
* See [f33e0fcc83954f728fcfd2ef6ae59435bc4af059](https://github.com/nodejs/node/commit/f33e0fcc83954f728fcfd2ef6ae59435bc4af059)
107107
*/
108-
export function compareStackTraceIdentifiers<T>(t: ExecutionContext<T>, actual: string, expected: string): void {
108+
export function compareStackTrace(t: ExecutionContext, actual: string, expected: string): void {
109109
const escapedTrace = expected
110110
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
111111
.replace(/-/g, '\\x2d')

packages/test/src/test-integration-split-one.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
} from '@temporalio/workflow';
3737
import { configurableHelpers, createTestWorkflowBundle } from './helpers-integration';
3838
import * as activities from './activities';
39-
import { cleanOptionalStackTrace, compareStackTraceIdentifiers, u8, Worker } from './helpers';
39+
import { cleanOptionalStackTrace, compareStackTrace, u8, Worker } from './helpers';
4040
import { configMacro, makeTestFn } from './helpers-integration-multi-codec';
4141
import * as workflows from './workflows';
4242

@@ -204,7 +204,7 @@ test.serial('activity-failure with ApplicationFailure', configMacro, async (t, c
204204
t.is(err.cause.cause.message, 'Fail me');
205205
t.is(err.cause.cause.type, 'Error');
206206
t.deepEqual(err.cause.cause.details, ['details', 123, false]);
207-
compareStackTraceIdentifiers(
207+
compareStackTrace(
208208
t,
209209
cleanOptionalStackTrace(err.cause.cause.stack)!,
210210
dedent`
@@ -259,7 +259,7 @@ test.serial('child-workflow-failure', configMacro, async (t, config) => {
259259
return t.fail('Expected err.cause.cause to be an instance of ApplicationFailure');
260260
}
261261
t.is(err.cause.cause.message, 'failure');
262-
compareStackTraceIdentifiers(
262+
compareStackTrace(
263263
t,
264264
cleanOptionalStackTrace(err.cause.cause.stack)!,
265265
dedent`

packages/test/src/test-integration-split-three.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { configMacro, makeTestFn } from './helpers-integration-multi-codec';
88
import { configurableHelpers } from './helpers-integration';
99
import { withZeroesHTTPServer } from './zeroes-http-server';
1010
import * as activities from './activities';
11-
import { approximatelyEqual, cleanOptionalStackTrace, compareStackTraceIdentifiers } from './helpers';
11+
import { approximatelyEqual, cleanOptionalStackTrace, compareStackTrace } from './helpers';
1212
import * as workflows from './workflows';
1313

1414
const test = makeTestFn(() => bundleWorkflowCode({ workflowsPath: require.resolve('./workflows') }));
@@ -93,7 +93,7 @@ if ('promiseHooks' in v8) {
9393
{
9494
const functionName = stacks[0]!.locations[0]!.function_name!;
9595
delete stacks[0]!.locations[0]!.function_name;
96-
compareStackTraceIdentifiers(t, functionName, '$CLASS.all');
96+
compareStackTrace(t, functionName, '$CLASS.all');
9797
}
9898
t.deepEqual(stacks, [
9999
{

packages/test/src/test-interceptors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { WorkflowClient, WorkflowFailedError } from '@temporalio/client';
1212
import { ApplicationFailure, TerminatedFailure } from '@temporalio/common';
1313
import { DefaultLogger, Runtime } from '@temporalio/worker';
1414
import { defaultPayloadConverter, WorkflowInfo } from '@temporalio/workflow';
15-
import { cleanOptionalStackTrace, compareStackTraceIdentifiers, RUN_INTEGRATION_TESTS, Worker } from './helpers';
15+
import { cleanOptionalStackTrace, compareStackTrace, RUN_INTEGRATION_TESTS, Worker } from './helpers';
1616
import { defaultOptions } from './mock-native-worker';
1717
import {
1818
continueAsNewToDifferentWorkflow,
@@ -241,7 +241,7 @@ if (RUN_INTEGRATION_TESTS) {
241241
return;
242242
}
243243
t.deepEqual(err.cause.message, 'Expected anything other than 1');
244-
compareStackTraceIdentifiers(
244+
compareStackTrace(
245245
t,
246246
cleanOptionalStackTrace(err.cause.stack)!,
247247
dedent`

packages/test/src/test-nexus-handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
convertWorkflowEventLinkToNexusLink,
2020
convertNexusLinkToWorkflowEventLink,
2121
} from '@temporalio/nexus/lib/link-converter';
22-
import { cleanStackTrace, compareStackTraceIdentifiers, getRandomPort } from './helpers';
22+
import { cleanStackTrace, compareStackTrace, getRandomPort } from './helpers';
2323

2424
export interface Context {
2525
httpPort: number;
@@ -314,7 +314,7 @@ test('start Operation Handler errors', async (t) => {
314314
});
315315
t.true(err instanceof ApplicationFailure);
316316
t.is(err.message, '');
317-
compareStackTraceIdentifiers(
317+
compareStackTrace(
318318
t,
319319
cleanStackTrace(err.stack!),
320320
`ApplicationFailure: deliberate failure
@@ -461,7 +461,7 @@ test('cancel Operation Handler errors', async (t) => {
461461
});
462462
t.true(err instanceof ApplicationFailure);
463463
t.is(err.message, '');
464-
compareStackTraceIdentifiers(
464+
compareStackTrace(
465465
t,
466466
cleanStackTrace(err.stack!),
467467
`ApplicationFailure: deliberate failure

packages/test/src/test-workflows.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { SdkFlag, SdkFlags } from '@temporalio/workflow/lib/flags';
2222
import { ReusableVMWorkflow, ReusableVMWorkflowCreator } from '@temporalio/worker/lib/workflow/reusable-vm';
2323
import { parseWorkflowCode } from '@temporalio/worker/lib/worker';
2424
import * as activityFunctions from './activities';
25-
import { cleanStackTrace, compareStackTraceIdentifiers, REUSE_V8_CONTEXT, u8 } from './helpers';
25+
import { cleanStackTrace, compareStackTrace, REUSE_V8_CONTEXT, u8 } from './helpers';
2626
import { ProcessedSignal } from './workflows';
2727

2828
export interface Context {
@@ -466,7 +466,7 @@ test('throwAsync', async (t) => {
466466
const req = cleanWorkflowFailureStackTrace(await activate(t, makeStartWorkflow(workflowType)));
467467
const actualStackTrace = removeWorkflowFailureStackTrace(req);
468468
compareCompletion(t, req, makeSuccess([makeFailWorkflowExecution('failure')]));
469-
compareStackTraceIdentifiers(
469+
compareStackTrace(
470470
t,
471471
actualStackTrace,
472472
dedent`
@@ -782,7 +782,7 @@ test('interruptableWorkflow', async (t) => {
782782
[SdkFlags.ProcessWorkflowActivationJobsAsSingleBatch]
783783
)
784784
);
785-
compareStackTraceIdentifiers(
785+
compareStackTrace(
786786
t,
787787
stackTrace,
788788
// The stack trace is weird here and might confuse users, it might be a JS limitation
@@ -813,7 +813,7 @@ test('failSignalWorkflow', async (t) => {
813813
[SdkFlags.ProcessWorkflowActivationJobsAsSingleBatch]
814814
)
815815
);
816-
compareStackTraceIdentifiers(
816+
compareStackTrace(
817817
t,
818818
stackTrace,
819819
dedent`
@@ -853,7 +853,7 @@ test('asyncFailSignalWorkflow', async (t) => {
853853
[SdkFlags.ProcessWorkflowActivationJobsAsSingleBatch]
854854
)
855855
);
856-
compareStackTraceIdentifiers(
856+
compareStackTrace(
857857
t,
858858
stackTrace,
859859
dedent`
@@ -1467,7 +1467,7 @@ test('cancellationErrorIsPropagated', async (t) => {
14671467
},
14681468
])
14691469
);
1470-
compareStackTraceIdentifiers(
1470+
compareStackTrace(
14711471
t,
14721472
stackTrace,
14731473
dedent`
@@ -1666,7 +1666,7 @@ test('resolve activity with failure - http', async (t) => {
16661666
);
16671667
const stackTrace = removeWorkflowFailureStackTrace(completion);
16681668
compareCompletion(t, completion, makeSuccess([makeFailWorkflowExecution('Connection timeout', 'MockError')]));
1669-
compareStackTraceIdentifiers(t, stackTrace, 'ApplicationFailure: Connection timeout');
1669+
compareStackTrace(t, stackTrace, 'ApplicationFailure: Connection timeout');
16701670
}
16711671
});
16721672

@@ -1879,7 +1879,7 @@ test('tryToContinueAfterCompletion', async (t) => {
18791879
const completion = cleanWorkflowFailureStackTrace(await activate(t, makeStartWorkflow(workflowType)));
18801880
const stackTrace = removeWorkflowFailureStackTrace(completion);
18811881
compareCompletion(t, completion, makeSuccess([makeFailWorkflowExecution('fail before continue')]));
1882-
compareStackTraceIdentifiers(
1882+
compareStackTrace(
18831883
t,
18841884
stackTrace,
18851885
dedent`

0 commit comments

Comments
 (0)