Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a4388b

Browse files
committed
fix: Explicitly set isolate devtool to cheap-source-map
1 parent 5101e67 commit 5a4388b

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/test/src/test-workflows.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ test('sync', async (t) => {
251251
* Replace path specifics from stack trace
252252
*/
253253
function cleanStackTrace(stack: string) {
254-
return stack.replace(/\bat (\S+) \(.*\)/g, (_, m0) => `at ${m0}`);
254+
return stack.replace(/\bat (\S+)(:\d+:\d+| \(.*\))/g, (_, m0) => `at ${m0}`);
255255
}
256256

257257
function cleanWorkflowFailureStackTrace(req: coresdk.workflow_completion.WFActivationCompletion, commandIndex = 0) {
@@ -275,7 +275,7 @@ test('throw-sync', async (t) => {
275275
dedent`
276276
Error: failure
277277
at Object.main
278-
at eval
278+
at workflow-isolate
279279
at Activator.startWorkflow
280280
at activate
281281
`
@@ -296,7 +296,7 @@ test('throw-async', async (t) => {
296296
dedent`
297297
Error: failure
298298
at Object.main
299-
at eval
299+
at workflow-isolate
300300
at Activator.startWorkflow
301301
at activate
302302
`
@@ -570,7 +570,7 @@ test('interrupt-signal', async (t) => {
570570
dedent`
571571
Error: just because
572572
at interrupt
573-
at eval
573+
at workflow-isolate
574574
at Activator.signalWorkflow
575575
at activate`,
576576
'Error'
@@ -601,7 +601,7 @@ test('fail-signal', async (t) => {
601601
dedent`
602602
Error: Signal failed
603603
at fail
604-
at eval
604+
at workflow-isolate
605605
at Activator.signalWorkflow
606606
at activate`,
607607
'Error'
@@ -1174,13 +1174,13 @@ test('cancellation-error-is-propagated', async (t) => {
11741174
dedent`
11751175
CancelledError: Cancelled
11761176
at CancellationScope.cancel
1177-
at eval
1178-
at eval
1177+
at workflow-isolate
1178+
at workflow-isolate
11791179
at AsyncLocalStorage.run
11801180
at CancellationScope.run
11811181
at Function.cancellable
11821182
at Object.main
1183-
at eval
1183+
at workflow-isolate
11841184
at Activator.startWorkflow
11851185
at activate
11861186
`,

packages/worker/src/isolate-builder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class WorkflowIsolateBuilder {
4747
this.genEntrypoint(vol, entrypointPath, workflows);
4848
await this.bundle(ufs, entrypointPath, sourceDir, distDir);
4949
const code = ufs.readFileSync(path.join(distDir, 'main.js'), 'utf8');
50-
const snapshot = ivm.Isolate.createSnapshot([{ code }]);
50+
const snapshot = ivm.Isolate.createSnapshot([{ code, filename: 'workflow-isolate' }]);
5151
return new ivm.Isolate({ snapshot, memoryLimit: this.maxIsolateMemoryMB });
5252
}
5353

@@ -105,6 +105,9 @@ export class WorkflowIsolateBuilder {
105105
entry: [entry],
106106
// TODO: production build?
107107
mode: 'development',
108+
// Explicitly set the devtool.
109+
// See https://github.com/temporalio/sdk-node/issues/139
110+
devtool: 'cheap-source-map',
108111
output: {
109112
path: distDir,
110113
filename: 'main.js',

0 commit comments

Comments
 (0)