yeoman-test 9.1.0 → 9.2.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/dist/run-context.d.ts +8 -0
- package/dist/run-context.js +13 -1
- package/package.json +1 -1
package/dist/run-context.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export declare class RunContextBase<GeneratorType extends BaseGenerator = Defaul
|
|
|
69
69
|
private ran;
|
|
70
70
|
private errored;
|
|
71
71
|
private readonly beforePrepareCallbacks;
|
|
72
|
+
private environmentRun?;
|
|
72
73
|
/**
|
|
73
74
|
* This class provide a run context object to façade the complexity involved in setting
|
|
74
75
|
* up a generator for testing
|
|
@@ -153,6 +154,13 @@ export declare class RunContextBase<GeneratorType extends BaseGenerator = Defaul
|
|
|
153
154
|
* @return {this} run context instance
|
|
154
155
|
*/
|
|
155
156
|
withEnvironment(callback: any): this;
|
|
157
|
+
/**
|
|
158
|
+
* Customize enviroment run method.
|
|
159
|
+
*
|
|
160
|
+
* @param callback
|
|
161
|
+
* @return {this} run context instance
|
|
162
|
+
*/
|
|
163
|
+
withEnvironmentRun(callback: (this: this, env: DefaultEnvironmentApi, gen: GeneratorType) => void): this;
|
|
156
164
|
/**
|
|
157
165
|
* Run lookup on the environment.
|
|
158
166
|
*
|
package/dist/run-context.js
CHANGED
|
@@ -46,6 +46,7 @@ export class RunContextBase extends EventEmitter {
|
|
|
46
46
|
ran = false;
|
|
47
47
|
errored = false;
|
|
48
48
|
beforePrepareCallbacks = [];
|
|
49
|
+
environmentRun;
|
|
49
50
|
/**
|
|
50
51
|
* This class provide a run context object to façade the complexity involved in setting
|
|
51
52
|
* up a generator for testing
|
|
@@ -81,7 +82,8 @@ export class RunContextBase extends EventEmitter {
|
|
|
81
82
|
await this.build();
|
|
82
83
|
}
|
|
83
84
|
try {
|
|
84
|
-
|
|
85
|
+
const environmentRun = this.environmentRun ?? ((env, generator) => env.runGenerator(generator));
|
|
86
|
+
await environmentRun.call(this, this.env, this.generator);
|
|
85
87
|
}
|
|
86
88
|
finally {
|
|
87
89
|
this.helpers.restorePrompt(this.env);
|
|
@@ -215,6 +217,16 @@ export class RunContextBase extends EventEmitter {
|
|
|
215
217
|
this.envCB = callback;
|
|
216
218
|
return this;
|
|
217
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Customize enviroment run method.
|
|
222
|
+
*
|
|
223
|
+
* @param callback
|
|
224
|
+
* @return {this} run context instance
|
|
225
|
+
*/
|
|
226
|
+
withEnvironmentRun(callback) {
|
|
227
|
+
this.environmentRun = callback;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
218
230
|
/**
|
|
219
231
|
* Run lookup on the environment.
|
|
220
232
|
*
|