Skip to content

Commit eb3f4d0

Browse files
committed
test from exposed entrypoint
1 parent 539c4ed commit eb3f4d0

File tree

6 files changed

+21
-67
lines changed

6 files changed

+21
-67
lines changed

example/convex/example.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import { components } from "./_generated/api.js";
66
import { vWorkflowId } from "@convex-dev/workflow";
77
import { vResultValidator } from "@convex-dev/workpool";
88

9-
export const workflow = new WorkflowManager(components.workflow, {
10-
workpoolOptions: {
11-
maxParallelism: 2,
12-
},
13-
});
9+
export const workflow = new WorkflowManager(components.workflow);
1410

1511
export const exampleWorkflow = workflow.define({
1612
args: {
@@ -113,7 +109,8 @@ export const flowCompleted = internalMutation({
113109
.withIndex("workflowId", (q) => q.eq("workflowId", args.workflowId))
114110
.first();
115111
if (!flow) {
116-
throw new Error(`Flow not found: ${args.workflowId}`);
112+
console.error(`Flow not found: ${args.workflowId}`);
113+
return;
117114
}
118115
await ctx.db.patch(flow._id, {
119116
out: args.result,

example/convex/setup.test.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@
22
import { test } from "vitest";
33
import { convexTest } from "convex-test";
44
import schema from "./schema";
5-
export const modules = import.meta.glob("./**/*.*s");
5+
import workflow from "@convex-dev/workflow/test";
66

7-
// Sorry about everything
8-
import componentSchema from "../../node_modules/@convex-dev/workflow/src/component/schema";
9-
export { componentSchema };
10-
export const componentModules = import.meta.glob(
11-
"../../node_modules/@convex-dev/workflow/src/component/**/*.ts",
12-
);
7+
export const modules = import.meta.glob("./**/*.*s");
138

149
export function initConvexTest() {
1510
const t = convexTest(schema, modules);
16-
t.registerComponent("bigPool", componentSchema, componentModules);
17-
t.registerComponent("smallPool", componentSchema, componentModules);
11+
t.registerComponent("workflow", workflow.schema, workflow.modules);
1812
return t;
1913
}
2014

package-lock.json

Lines changed: 9 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"types": "./dist/client/index.d.ts",
4444
"default": "./dist/client/index.js"
4545
},
46+
"./test": "./src/test.ts",
4647
"./convex.config": {
4748
"@convex-dev/component-source": "./src/component/convex.config.ts",
4849
"types": "./dist/component/convex.config.d.ts",
@@ -58,14 +59,14 @@
5859
"async-channel": "^0.2.0"
5960
},
6061
"devDependencies": {
61-
"@convex-dev/workflow": "file:.",
6262
"@edge-runtime/vm": "5.0.0",
6363
"@eslint/eslintrc": "3.3.1",
6464
"@eslint/js": "9.37.0",
6565
"@types/node": "22.18.8",
6666
"@typescript-eslint/eslint-plugin": "8.40.0",
6767
"@typescript-eslint/parser": "8.40.0",
6868
"chokidar-cli": "3.0.0",
69+
"convex": "^1.27.3",
6970
"convex-test": "0.0.38",
7071
"cpy-cli": "6.0.0",
7172
"eslint": "9.37.0",

src/test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import schema from "./component/schema.js";
2+
const modules = import.meta.glob("./**/*.ts");
3+
export default { schema, modules };

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "./tsconfig.json",
33
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.d.ts"],
4-
"exclude": ["src/**/*.test.*", "src/vitest.config.ts"],
4+
"exclude": ["src/**/*.test.*", "src/vitest.config.ts", "src/test.ts"],
55
"compilerOptions": {
66
"module": "ESNext",
77
"moduleResolution": "Bundler",

0 commit comments

Comments
 (0)