@nestjs/testing 9.3.5 → 9.3.7
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/package.json
CHANGED
|
@@ -10,7 +10,6 @@ export declare class TestingModuleBuilder {
|
|
|
10
10
|
private readonly metadataScanner;
|
|
11
11
|
private readonly applicationConfig;
|
|
12
12
|
private readonly container;
|
|
13
|
-
private readonly injector;
|
|
14
13
|
private readonly overloadsMap;
|
|
15
14
|
private readonly module;
|
|
16
15
|
private testingLogger;
|
|
@@ -23,7 +22,7 @@ export declare class TestingModuleBuilder {
|
|
|
23
22
|
overrideGuard<T = any>(typeOrToken: T): OverrideBy;
|
|
24
23
|
overrideInterceptor<T = any>(typeOrToken: T): OverrideBy;
|
|
25
24
|
overrideProvider<T = any>(typeOrToken: T): OverrideBy;
|
|
26
|
-
compile(options?: Pick<NestApplicationContextOptions, 'snapshot'>): Promise<TestingModule>;
|
|
25
|
+
compile(options?: Pick<NestApplicationContextOptions, 'snapshot' | 'preview'>): Promise<TestingModule>;
|
|
27
26
|
private override;
|
|
28
27
|
private createOverrideByBuilder;
|
|
29
28
|
private applyOverloadsMap;
|
|
@@ -20,7 +20,6 @@ class TestingModuleBuilder {
|
|
|
20
20
|
this.metadataScanner = metadataScanner;
|
|
21
21
|
this.applicationConfig = new application_config_1.ApplicationConfig();
|
|
22
22
|
this.container = new container_1.NestContainer(this.applicationConfig);
|
|
23
|
-
this.injector = new testing_injector_1.TestingInjector();
|
|
24
23
|
this.overloadsMap = new Map();
|
|
25
24
|
this.module = this.createModule(metadata);
|
|
26
25
|
}
|
|
@@ -61,7 +60,7 @@ class TestingModuleBuilder {
|
|
|
61
60
|
const scanner = new scanner_1.DependenciesScanner(this.container, this.metadataScanner, graphInspector, this.applicationConfig);
|
|
62
61
|
await scanner.scan(this.module);
|
|
63
62
|
this.applyOverloadsMap();
|
|
64
|
-
await this.createInstancesOfDependencies(graphInspector);
|
|
63
|
+
await this.createInstancesOfDependencies(graphInspector, options);
|
|
65
64
|
scanner.applyApplicationProviders();
|
|
66
65
|
const root = this.getRootModule();
|
|
67
66
|
return new testing_module_1.TestingModule(this.container, graphInspector, root, this.applicationConfig);
|
|
@@ -89,8 +88,12 @@ class TestingModuleBuilder {
|
|
|
89
88
|
const modules = this.container.getModules().values();
|
|
90
89
|
return modules.next().value;
|
|
91
90
|
}
|
|
92
|
-
async createInstancesOfDependencies(graphInspector) {
|
|
93
|
-
|
|
91
|
+
async createInstancesOfDependencies(graphInspector, options) {
|
|
92
|
+
var _a;
|
|
93
|
+
const injector = new testing_injector_1.TestingInjector({
|
|
94
|
+
preview: (_a = options === null || options === void 0 ? void 0 : options.preview) !== null && _a !== void 0 ? _a : false,
|
|
95
|
+
});
|
|
96
|
+
const instanceLoader = new testing_instance_loader_1.TestingInstanceLoader(this.container, injector, graphInspector);
|
|
94
97
|
await instanceLoader.createInstancesOfDependencies(this.container.getModules(), this.mocker);
|
|
95
98
|
}
|
|
96
99
|
createModule(metadata) {
|