@velajs/testing 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/testing-module.builder.js +19 -19
- package/package.json +13 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0 (2026-07-04)
|
|
4
|
+
|
|
5
|
+
- `ComponentManager.init` call removed; provider overrides use the supported `Container.replaceProvider`; registers `DiscoveryService` mirroring bootstrap. Requires `@velajs/vela >=1.11.0`.
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
## 0.2.1 (2026-05-14)
|
|
4
9
|
|
|
5
10
|
### Fixes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { REQUEST_CONTEXT, Scope } from "@velajs/vela";
|
|
2
|
-
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_MIDDLEWARE, APP_PIPE,
|
|
1
|
+
import { DiscoveryService, REQUEST_CONTEXT, Scope } from "@velajs/vela";
|
|
2
|
+
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_MIDDLEWARE, APP_PIPE, Container, MetadataRegistry, ModuleLoader, ModuleRef, RouteManager, VelaApplication, bindAppProviders } from "@velajs/vela/internal";
|
|
3
3
|
import { TestingModule } from "./testing-module.js";
|
|
4
4
|
export class OverrideBy {
|
|
5
5
|
builder;
|
|
@@ -97,6 +97,17 @@ export class TestingModuleBuilder {
|
|
|
97
97
|
]
|
|
98
98
|
});
|
|
99
99
|
container.markGlobalToken(ModuleRef);
|
|
100
|
+
// Decorator-driven discovery — global so any provider can inject it, and so
|
|
101
|
+
// callOnApplicationBootstrap() reuses this instance instead of self-building
|
|
102
|
+
// one. Mirrors vela/src/factory/bootstrap.ts.
|
|
103
|
+
container.register({
|
|
104
|
+
provide: DiscoveryService,
|
|
105
|
+
useFactory: (c)=>new DiscoveryService(c),
|
|
106
|
+
inject: [
|
|
107
|
+
Container
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
container.markGlobalToken(DiscoveryService);
|
|
100
111
|
for (const t of [
|
|
101
112
|
APP_GUARD,
|
|
102
113
|
APP_PIPE,
|
|
@@ -126,27 +137,16 @@ export class TestingModuleBuilder {
|
|
|
126
137
|
container.register(override.provider);
|
|
127
138
|
}
|
|
128
139
|
const routeManager = new RouteManager(container);
|
|
129
|
-
ComponentManager.init(container);
|
|
130
140
|
const loader = new ModuleLoader(container, routeManager);
|
|
131
141
|
loader.load(TestRootModule);
|
|
132
142
|
// Force-apply overrides into every module bucket that already holds the
|
|
133
|
-
// token. Without this, controller constructor-injection (which
|
|
134
|
-
// requestingModuleId to findRegistration) finds the module's own
|
|
135
|
-
// registration first and never consults the root override.
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
// Reaches into Container internals (the `providers` map) until vela
|
|
139
|
-
// exposes a public "force replace across all scopes" API. The shape is
|
|
140
|
-
// stable in vela 1.6.x; if this breaks under a future vela version, raise
|
|
141
|
-
// a vela API request before working around again.
|
|
142
|
-
const providersMap = container.providers;
|
|
143
|
+
// token (plus root). Without this, controller constructor-injection (which
|
|
144
|
+
// passes requestingModuleId to findRegistration) finds the module's own
|
|
145
|
+
// registration first and never consults the root override. The default
|
|
146
|
+
// 'all-existing' buckets replace every non-root bucket holding the token
|
|
147
|
+
// and re-register at root — the supported form of the old private loop.
|
|
143
148
|
for (const override of this.overrides){
|
|
144
|
-
|
|
145
|
-
if (moduleId === '__root__') continue;
|
|
146
|
-
if (bucket.has(override.token)) {
|
|
147
|
-
container.register(override.provider, moduleId);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
149
|
+
container.replaceProvider(override.provider);
|
|
150
150
|
}
|
|
151
151
|
bindAppProviders(routeManager, container, loader);
|
|
152
152
|
const app = new VelaApplication(container, routeManager);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velajs/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Testing utilities for Vela framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
"LICENSE",
|
|
18
18
|
"CHANGELOG.md"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rm -rf dist && swc src -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
|
|
22
|
-
"test": "vitest run",
|
|
23
|
-
"typecheck": "tsc --noEmit",
|
|
24
|
-
"prepublishOnly": "pnpm run typecheck && pnpm test"
|
|
25
|
-
},
|
|
26
20
|
"sideEffects": false,
|
|
27
21
|
"keywords": [
|
|
28
22
|
"vela",
|
|
@@ -47,24 +41,22 @@
|
|
|
47
41
|
"node": ">=20"
|
|
48
42
|
},
|
|
49
43
|
"peerDependencies": {
|
|
50
|
-
"@velajs/vela": ">=1.
|
|
44
|
+
"@velajs/vela": ">=1.11.0",
|
|
51
45
|
"hono": ">=4"
|
|
52
46
|
},
|
|
53
47
|
"devDependencies": {
|
|
54
|
-
"@swc/cli": "^0.8.
|
|
55
|
-
"@swc/core": "^1.15.
|
|
48
|
+
"@swc/cli": "^0.8.1",
|
|
49
|
+
"@swc/core": "^1.15.41",
|
|
56
50
|
"@types/bun": "latest",
|
|
57
|
-
"@velajs/vela": "^1.
|
|
58
|
-
"hono": "^4",
|
|
59
|
-
"typescript": "^
|
|
51
|
+
"@velajs/vela": "^1.12.0",
|
|
52
|
+
"hono": "^4.12.26",
|
|
53
|
+
"typescript": "^6.0.3",
|
|
60
54
|
"unplugin-swc": "^1.5.9",
|
|
61
|
-
"vitest": "^4.
|
|
55
|
+
"vitest": "^4.1.9"
|
|
62
56
|
},
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
"esbuild"
|
|
68
|
-
]
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "rm -rf dist && swc src -d dist --strip-leading-paths && tsc --emitDeclarationOnly",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
69
61
|
}
|
|
70
|
-
}
|
|
62
|
+
}
|