yeoman-test 11.5.2 → 11.5.3
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/dist/run-context.d.ts +3 -3
- package/dist/run-result.d.ts +4 -4
- package/dist/run-result.js +2 -2
- package/package.json +1 -1
package/dist/run-context.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ type EnvironmentOptions = BaseEnvironmentOptions & {
|
|
|
37
37
|
createEnv?: CreateEnvironment;
|
|
38
38
|
};
|
|
39
39
|
export declare class RunContextBase<GeneratorType extends BaseGenerator = DefaultGeneratorApi> extends EventEmitter {
|
|
40
|
-
readonly mockedGenerators: Record<string,
|
|
40
|
+
readonly mockedGenerators: Record<string, unknown>;
|
|
41
41
|
env: DefaultEnvironmentApi;
|
|
42
42
|
generator: GeneratorType;
|
|
43
43
|
readonly settings: RunContextSettings;
|
|
@@ -153,14 +153,14 @@ export declare class RunContextBase<GeneratorType extends BaseGenerator = Defaul
|
|
|
153
153
|
* @param {Function} [cb] - callback who'll receive the folder path as argument
|
|
154
154
|
* @return {this} run context instance
|
|
155
155
|
*/
|
|
156
|
-
withEnvironment(callback: (this: this, environment: DefaultEnvironmentApi) => DefaultEnvironmentApi | void): this;
|
|
156
|
+
withEnvironment(callback: (this: this, environment: DefaultEnvironmentApi) => DefaultEnvironmentApi | void | Promise<DefaultEnvironmentApi | void>): this;
|
|
157
157
|
/**
|
|
158
158
|
* Customize enviroment run method.
|
|
159
159
|
*
|
|
160
160
|
* @param callback
|
|
161
161
|
* @return {this} run context instance
|
|
162
162
|
*/
|
|
163
|
-
withEnvironmentRun(callback: (this: this, env: DefaultEnvironmentApi, gen: GeneratorType) => void): this;
|
|
163
|
+
withEnvironmentRun(callback: (this: this, env: DefaultEnvironmentApi, gen: GeneratorType) => void | Promise<void>): this;
|
|
164
164
|
/**
|
|
165
165
|
* Run lookup on the environment.
|
|
166
166
|
*
|
package/dist/run-result.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type RunResultOptions<GeneratorType extends BaseGenerator> = {
|
|
|
34
34
|
/**
|
|
35
35
|
* The mocked generators of the context.
|
|
36
36
|
*/
|
|
37
|
-
mockedGenerators: Record<string,
|
|
37
|
+
mockedGenerators: Record<string, unknown>;
|
|
38
38
|
spawnStub?: any;
|
|
39
39
|
settings: RunContextSettings;
|
|
40
40
|
helpers: YeomanTest;
|
|
@@ -50,7 +50,7 @@ export default class RunResult<GeneratorType extends BaseGenerator = BaseGenerat
|
|
|
50
50
|
oldCwd: string;
|
|
51
51
|
memFs: Store<MemFsEditorFile>;
|
|
52
52
|
fs: MemFsEditor;
|
|
53
|
-
mockedGenerators: Record<string,
|
|
53
|
+
mockedGenerators: Record<string, unknown>;
|
|
54
54
|
options: RunResultOptions<GeneratorType>;
|
|
55
55
|
spawnStub?: any;
|
|
56
56
|
readonly askedQuestions: AskedQuestions;
|
|
@@ -217,9 +217,9 @@ export default class RunResult<GeneratorType extends BaseGenerator = BaseGenerat
|
|
|
217
217
|
/**
|
|
218
218
|
* Get the generator mock
|
|
219
219
|
* @param generator - the namespace of the mocked generator
|
|
220
|
-
* @returns the generator mock
|
|
220
|
+
* @returns the generator mock, by default is the mock property of node:test's mock.
|
|
221
221
|
*/
|
|
222
|
-
getGeneratorMock
|
|
222
|
+
getGeneratorMock<MockType = ReturnType<typeof mock.fn>['mock']>(generator: string): MockType;
|
|
223
223
|
/**
|
|
224
224
|
* Get the number of times a mocked generator was composed
|
|
225
225
|
* @param generator - the namespace of the mocked generator
|
package/dist/run-result.js
CHANGED
|
@@ -271,14 +271,14 @@ export default class RunResult {
|
|
|
271
271
|
/**
|
|
272
272
|
* Get the generator mock
|
|
273
273
|
* @param generator - the namespace of the mocked generator
|
|
274
|
-
* @returns the generator mock
|
|
274
|
+
* @returns the generator mock, by default is the mock property of node:test's mock.
|
|
275
275
|
*/
|
|
276
276
|
getGeneratorMock(generator) {
|
|
277
277
|
const mockedGenerator = this.mockedGenerators[generator];
|
|
278
278
|
if (!mockedGenerator) {
|
|
279
279
|
throw new Error(`Generator ${generator} is not mocked`);
|
|
280
280
|
}
|
|
281
|
-
return mockedGenerator.mock;
|
|
281
|
+
return (mockedGenerator.mock ?? mockedGenerator);
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* Get the number of times a mocked generator was composed
|