yeoman-test 9.1.0 → 10.0.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/adapter.d.ts +1 -1
- package/dist/adapter.js +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mock-wrapper.d.ts +4 -0
- package/dist/mock-wrapper.js +6 -0
- package/dist/mock.d.ts +4 -0
- package/dist/mock.js +6 -0
- package/dist/run-context.d.ts +8 -0
- package/dist/run-context.js +13 -1
- package/package.json +4 -3
package/dist/adapter.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { TestAdapter as BaseTestAdapter, type TestAdapterOptions } from '@yeoman
|
|
|
2
2
|
export declare class TestAdapter extends BaseTestAdapter {
|
|
3
3
|
constructor(options?: TestAdapterOptions);
|
|
4
4
|
}
|
|
5
|
-
export {
|
|
5
|
+
export { type DummyPromptOptions, type DummyPromptCallback, type TestAdapterOptions } from '@yeoman/adapter/testing';
|
|
6
6
|
export type AskedQuestions = Array<{
|
|
7
7
|
name: string;
|
|
8
8
|
answer: any;
|
package/dist/adapter.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { default, createHelpers, YeomanTest, type Dependency } from './helpers.j
|
|
|
2
2
|
export { default as RunContext, RunContextBase, type RunContextSettings } from './run-context.js';
|
|
3
3
|
export { default as RunResult, type RunResultOptions } from './run-result.js';
|
|
4
4
|
export { default as context, result } from './test-context.js';
|
|
5
|
-
export {
|
|
5
|
+
export { TestAdapter } from './adapter.js';
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export { default, createHelpers, YeomanTest } from './helpers.js';
|
|
|
2
2
|
export { default as RunContext, RunContextBase } from './run-context.js';
|
|
3
3
|
export { default as RunResult } from './run-result.js';
|
|
4
4
|
export { default as context, result } from './test-context.js';
|
|
5
|
-
export {
|
|
5
|
+
export { TestAdapter } from './adapter.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-ignore - test is optional alternative to node:test
|
|
3
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
4
|
+
const { mock: actualMock } = await import('node:test').catch(() => import('test'));
|
|
5
|
+
const mock = actualMock;
|
|
6
|
+
export { mock };
|
package/dist/mock.d.ts
ADDED
package/dist/mock.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-ignore - test is optional alternative to node:test
|
|
3
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
4
|
+
const { mock: actualMock } = await import('node:test').catch(() => import('test'));
|
|
5
|
+
const mock = actualMock;
|
|
6
|
+
export { mock };
|
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
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yeoman-test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Test utilities for Yeoman generators",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yeoman",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"doc_path": "../yeoman-test-doc"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@yeoman/adapter": "^1.6.0",
|
|
46
45
|
"lodash-es": "^4.17.21",
|
|
47
46
|
"mem-fs-editor": "^11.1.1",
|
|
48
47
|
"signal-exit": "^4.1.0",
|
|
@@ -50,6 +49,7 @@
|
|
|
50
49
|
"type-fest": "^4.25.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
52
|
+
"@yeoman/adapter": "^2.0.0",
|
|
53
53
|
"@types/lodash-es": "^4.17.12",
|
|
54
54
|
"@types/node": "^18.19.46",
|
|
55
55
|
"@vitest/coverage-v8": "^2.0.5",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"yeoman-generator": "^7.3.2"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@yeoman/
|
|
70
|
+
"@yeoman/adapter": "^1.6.0 || ^2.0.0",
|
|
71
|
+
"@yeoman/types": "^1.5.0",
|
|
71
72
|
"mem-fs": "^4.1.0",
|
|
72
73
|
"yeoman-environment": "^4.0.0",
|
|
73
74
|
"yeoman-generator": "^7.0.0"
|