mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
32ac8e73fd
* Fix Biome lint violations and add Biome CI check Biome was not configured to respect .gitignore, so ~92% of the 13,355 reported diagnostics came from gitignored build artifacts. Enable VCS integration (useIgnoreFile), apply safe auto-fixes across the repo, fix the remaining mechanical errors by hand, downgrade judgment-call a11y / dangerouslySetInnerHTML rules to warnings, and add a 'biome ci' job to the Lint workflow so violations block PRs going forward. * Use an empty changeset (no behavior change, no release needed)
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { hydrateWorkflowReturnValue } from '@workflow/core/serialization';
|
|
import { expect, test, vi } from 'vitest';
|
|
import { createFetcher, startServer } from './util.mjs';
|
|
|
|
export function errors(world: string) {
|
|
test('retriable and fatal errors', { timeout: 59_000 }, async () => {
|
|
const server = await startServer({ world }).then(createFetcher);
|
|
const result = await server.invoke(
|
|
'workflows/retriable-and-fatal.ts',
|
|
'retryableAndFatalErrorWorkflow',
|
|
[]
|
|
);
|
|
expect(result.runId).toMatch(/^wrun_.+/);
|
|
const run = await vi.waitFor(
|
|
async () => {
|
|
const run = await server.getRun(result.runId);
|
|
expect(run).toMatchObject<Partial<typeof run>>({
|
|
status: 'completed',
|
|
});
|
|
return run;
|
|
},
|
|
{
|
|
interval: 200,
|
|
timeout: 50_000,
|
|
}
|
|
);
|
|
const output = (await hydrateWorkflowReturnValue(
|
|
run.output!,
|
|
run.runId,
|
|
undefined
|
|
)) as any;
|
|
expect(output).toEqual({
|
|
gotFatalError: true,
|
|
retryableResult: {
|
|
attempt: 2,
|
|
duration: expect.any(Number),
|
|
stepStartedAt: expect.any(Date),
|
|
},
|
|
});
|
|
expect(output.retryableResult.duration).toBeGreaterThanOrEqual(2000);
|
|
});
|
|
}
|