test(mesh): steps-only exports across Deno, Bun and the edge
Deno and Bun mesh fixtures still exported a @Provider, which now throws at boot. Convert each to a @Step (provide() -> run(), move the class from providers: [] to steps: []) so the fixtures build a graph the current mesh actually allows. test/edge/_worker.mjs is a gitignored esbuild bundle rebuilt by test/edge/run.ts on every test:edge run, so no source change was needed there once the fixtures matched. All four suites pass: vitest (Node), deno test, bun test, and the workerd/miniflare edge run, plus typecheck. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
5 files changed
+20
-20
No files matched your search
@@ -8,14 +8,14 @@
|
||||
// Run with: npm run test:bun
|
||||
import 'reflect-metadata';
|
||||
import { test, expect } from 'bun:test';
|
||||
import { createApp, Provider, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { createApp, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { serveBun } from '../../src/bun.ts';
|
||||
|
||||
const SECRET = 's3cr3t';
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class Config {
|
||||
provide() {
|
||||
run() {
|
||||
return { config: { runtime: 'bun' } };
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class Auth {
|
||||
return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } };
|
||||
}
|
||||
}
|
||||
@Module({ mountpoint: '/api', providers: [Config], steps: [Auth] })
|
||||
@Module({ mountpoint: '/api', steps: [Config, Auth] })
|
||||
class TeapotModule {}
|
||||
|
||||
@Route('/local')
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
// Run with: npm run test:bun
|
||||
import 'reflect-metadata';
|
||||
import { test, expect } from 'bun:test';
|
||||
import { createApp, Provider, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { createApp, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { serveBun } from '../../src/bun.ts';
|
||||
|
||||
const SECRET = 's3cr3t';
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class Config {
|
||||
provide() {
|
||||
run() {
|
||||
return { config: { region: 'mx', runtime: 'bun' } };
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class Auth {
|
||||
return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } };
|
||||
}
|
||||
}
|
||||
@Module({ mountpoint: '/api', providers: [Config], steps: [Auth] })
|
||||
@Module({ mountpoint: '/api', steps: [Config, Auth] })
|
||||
class TeapotModule {}
|
||||
|
||||
@Route('/local')
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
// Run with: npm run test:deno (needs --allow-run to spawn the Node peer)
|
||||
import 'npm:reflect-metadata';
|
||||
import { assertEquals, assertStringIncludes } from 'jsr:@std/assert';
|
||||
import { createApp, Provider, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { createApp, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
|
||||
const SECRET = 's3cr3t';
|
||||
const NODE_PEER = 'test/interop/_node-peer.ts';
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class Config {
|
||||
provide() {
|
||||
run() {
|
||||
return { config: { region: 'mx', runtime: 'deno' } };
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class Auth {
|
||||
return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } };
|
||||
}
|
||||
}
|
||||
@Module({ mountpoint: '/api', providers: [Config], steps: [Auth] })
|
||||
@Module({ mountpoint: '/api', steps: [Config, Auth] })
|
||||
class TeapotModule {}
|
||||
|
||||
@Route('/local')
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
// Run with: npm run test:deno
|
||||
import 'npm:reflect-metadata';
|
||||
import { assertEquals } from 'jsr:@std/assert';
|
||||
import { createApp, Provider, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { createApp, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { serveDeno } from '../../src/deno.ts';
|
||||
|
||||
const SECRET = 's3cr3t';
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class Config {
|
||||
provide() {
|
||||
run() {
|
||||
return { config: { runtime: 'deno' } };
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class Auth {
|
||||
return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } };
|
||||
}
|
||||
}
|
||||
@Module({ mountpoint: '/api', providers: [Config], steps: [Auth] })
|
||||
@Module({ mountpoint: '/api', steps: [Config, Auth] })
|
||||
class TeapotModule {}
|
||||
|
||||
@Route('/local')
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
// including Node-only modules this test never executes. tsc covers those.
|
||||
import 'npm:reflect-metadata';
|
||||
import { assertEquals, assertStringIncludes } from 'jsr:@std/assert';
|
||||
import { createApp, Provider, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { createApp, Step, Route, Get, Module, needs } from '../../src/index.ts';
|
||||
import { serveDeno } from '../../src/deno.ts';
|
||||
|
||||
const SECRET = 's3cr3t';
|
||||
|
||||
@Provider({ provides: 'config', export: true })
|
||||
@Step({ provides: 'config', needs: [], export: true })
|
||||
class Config {
|
||||
provide() {
|
||||
run() {
|
||||
return { config: { region: 'mx', runtime: 'deno' } };
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class Auth {
|
||||
return { auth: { token: ctx.headers?.['x-token'] ?? 'anon' } };
|
||||
}
|
||||
}
|
||||
@Module({ mountpoint: '/api', providers: [Config], steps: [Auth] })
|
||||
@Module({ mountpoint: '/api', steps: [Config, Auth] })
|
||||
class TeapotModule {}
|
||||
|
||||
@Route('/local')
|
||||
|
||||
Reference in new issue
Block a user