Skip to content

fix: normalize workbench tests#292

Merged
adriandlam merged 28 commits into
pranaygp/normalize-workbenchesfrom
fix/pranay-normalize-workbench
Nov 12, 2025
Merged

fix: normalize workbench tests#292
adriandlam merged 28 commits into
pranaygp/normalize-workbenchesfrom
fix/pranay-normalize-workbench

Conversation

@adriandlam
Copy link
Copy Markdown
Contributor

No description provided.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 10, 2025

🦋 Changeset detected

Latest commit: b6d2d7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@workflow/nitro Patch
@workflow/sveltekit Patch
@workflow/nuxt Patch
workflow Patch
@workflow/ai Patch
@workflow/world-testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Nov 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Nov 12, 2025 5:20pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Nov 12, 2025 5:20pm
example-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workbench-hono-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workbench-nitro-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workbench-nuxt-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workbench-sveltekit-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workbench-vite-workflow Ready Ready Preview Comment Nov 12, 2025 5:20pm
workflow-docs Ready Ready Preview Comment Nov 12, 2025 5:20pm

@vercel vercel Bot temporarily deployed to Preview – workflow-docs November 10, 2025 17:51 Inactive
Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Build Fix:

The StructuredErrorSchema import is declared but never used in the file, causing a TypeScript compilation error TS6133.

View Details
📝 Patch Details
diff --git a/packages/world-vercel/src/steps.ts b/packages/world-vercel/src/steps.ts
index 0cb4959..8323344 100644
--- a/packages/world-vercel/src/steps.ts
+++ b/packages/world-vercel/src/steps.ts
@@ -6,7 +6,6 @@ import {
   PaginatedResponseSchema,
   type Step,
   StepSchema,
-  StructuredErrorSchema,
   type UpdateStepRequest,
 } from '@workflow/world';
 import { z } from 'zod';

Analysis

Unused import causes TypeScript compilation failure

What fails: TypeScript compiler fails on packages/world-vercel/src/steps.ts due to unused import StructuredErrorSchema

How to reproduce:

pnpm turbo run build --filter=@workflow/world-vercel

Result:

src/steps.ts(9,3): error TS6133: 'StructuredErrorSchema' is declared but its value is never read.
 ELIFECYCLE  Command failed with exit code 2.
Fix on Vercel

Comment thread workbench/example/api/trigger.ts
Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

The test uses a .toBeOneOf() matcher that doesn't exist in vitest, causing test failures with "expect(...).toBeOneOf is not a function".

View Details
📝 Patch Details
diff --git a/packages/core/e2e/e2e.test.ts b/packages/core/e2e/e2e.test.ts
index 5076b61..7e5103d 100644
--- a/packages/core/e2e/e2e.test.ts
+++ b/packages/core/e2e/e2e.test.ts
@@ -91,11 +91,11 @@ describe('e2e', () => {
     });
     // In local vs. vercel backends, the workflow name is different, so we check for either,
     // since this test runs against both. Also different workbenches have different directory structures.
-    expect(json.workflowName).toBeOneOf([
+    expect([
       `workflow//example/${workflow.workflowFile}//${workflow.workflowFn}`,
       `workflow//${workflow.workflowFile}//${workflow.workflowFn}`,
       `workflow//src/${workflow.workflowFile}//${workflow.workflowFn}`,
-    ]);
+    ]).toContain(json.workflowName);
   });
 
   test('promiseAllWorkflow', { timeout: 60_000 }, async () => {
@@ -158,7 +158,7 @@ describe('e2e', () => {
     // NOTE: For Nitro apps (Vite, Hono, etc.) in dev mode, status 404 does some
     // unexpected stuff and could return a Vite SPA fallback or can cause a Hono route to hang.
     // This is because Nitro passes the 404 requests to the dev server to handle.
-    expect(res.status).toBeOneOf([404, 422]);
+    expect([404, 422]).toContain(res.status);
     body = await res.json();
     expect(body).toBeNull();
 

Analysis

Undefined .toBeOneOf() matcher in e2e tests

What fails: Tests in packages/core/e2e/e2e.test.ts use .toBeOneOf() matcher on lines 94 and 161, which is not a standard vitest matcher and is not defined anywhere in the codebase, causing test execution failures with "expect(...).toBeOneOf is not a function"

How to reproduce:

# Run the e2e tests
pnpm test:e2e

The tests will fail when encountering the .toBeOneOf() calls because vitest does not recognize this matcher.

Result: Runtime error: TypeError: expect(...).toBeOneOf is not a function

Expected: Tests should use standard vitest matchers. The .toBeOneOf() usage checks if a value belongs to an array of possible values. The standard vitest approach is to use .toContain() on an array, reversing the assertion operands.

Fix applied: Replaced both instances of .toBeOneOf() with .toContain():

  • Line 94: Changed expect(json.workflowName).toBeOneOf([...]) to expect([...]).toContain(json.workflowName)
  • Line 161: Changed expect(res.status).toBeOneOf([404, 422]) to expect([404, 422]).toContain(res.status)

This is the standard vitest pattern for checking membership in an array, as documented in the vitest expect API.

Fix on Vercel

Comment thread packages/nitro/src/vite.ts
}
server.ws.send({
type: 'full-reload',
path: '*',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm too aggressive?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably fine for now and we can revisit

Comment thread workbench/hono/server.ts
Comment thread workbench/hono/server.ts
@@ -163,8 +163,8 @@ app.post('/api/hook', async ({ req }) => {
} catch (error) {
console.log('error during getHookByToken', error);
// TODO: `WorkflowAPIError` is not exported, so for now
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @TooTallNate we should have a HookNotFound error thrown from the world?

Comment thread workbench/vite/routes/api/hook.post.ts
Comment thread workbench/vite/resolve-symlinks.sh Outdated
Copy link
Copy Markdown
Contributor

@pranaygp pranaygp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments but let's merge it into the upstream PR and feel free to address here or there :)

@vercel vercel Bot mentioned this pull request Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants