yeoman-test 8.0.0-alpha.2 → 8.0.0-alpha.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/helpers.d.ts CHANGED
@@ -72,7 +72,7 @@ export declare class YeomanTest {
72
72
  /**
73
73
  * Create a simple, dummy generator
74
74
  */
75
- createDummyGenerator<GenParameter extends BaseGenerator = GeneratorImplementation>(Generator?: GetGeneratorConstructor<GenParameter>, contents?: Record<string, (...args: any[]) => void>): GenParameter;
75
+ createDummyGenerator<GenParameter extends BaseGenerator = GeneratorImplementation>(Generator?: GetGeneratorConstructor<GenParameter>, contents?: Record<string, (...args: any[]) => void>): new (...args: any[]) => GenParameter;
76
76
  /**
77
77
  * Create a generator, using the given dependencies and controller arguments
78
78
  * Dependecies can be path (autodiscovery) or an array [{generator}, {name}]
package/dist/helpers.js CHANGED
@@ -109,13 +109,14 @@ export class YeomanTest {
109
109
  /**
110
110
  * Create a mocked generator
111
111
  */
112
- createMockedGenerator(GeneratorClass = class MockedGenerator extends GeneratorImplementation {
113
- }) {
114
- const generator = sinonSpy(GeneratorClass);
112
+ createMockedGenerator(GeneratorClass = GeneratorImplementation) {
113
+ class MockedGenerator extends GeneratorClass {
114
+ }
115
+ const generator = sinonSpy(MockedGenerator);
115
116
  for (const methodName of ['run', 'queueTasks', 'runWithOptions', 'queueOwnTasks']) {
116
- if (GeneratorClass.prototype[methodName]) {
117
- GeneratorClass.prototype[methodName] = sinonStub();
118
- }
117
+ Object.defineProperty(MockedGenerator.prototype, methodName, {
118
+ value: sinonStub(),
119
+ });
119
120
  }
120
121
  return generator;
121
122
  }
@@ -129,8 +130,11 @@ export class YeomanTest {
129
130
  }) {
130
131
  class DummyGenerator extends Generator {
131
132
  constructor(...args) {
132
- args[1].namespace = args[1].namespace ?? 'dummy';
133
- args[1].resolved = args[1].resolved ?? 'dummy';
133
+ const optIndex = Array.isArray(args[0]) ? 1 : 0;
134
+ args[optIndex] = args[optIndex] ?? {};
135
+ const options = args[optIndex];
136
+ options.namespace = options.namespace ?? 'dummy';
137
+ options.resolved = options.resolved ?? 'dummy';
134
138
  super(...args);
135
139
  }
136
140
  }
@@ -66,7 +66,8 @@ export default class RunResult<GeneratorType extends BaseGenerator = GeneratorIm
66
66
  * @returns {Object}
67
67
  */
68
68
  getStateSnapshot(filter?: any): Record<string, {
69
- stateCleared: string;
69
+ stateCleared?: string;
70
+ state?: string;
70
71
  }>;
71
72
  /**
72
73
  * Either dumps the contents of the specified files or the name and the contents of each file to the console.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-test",
3
- "version": "8.0.0-alpha.2",
3
+ "version": "8.0.0-alpha.3",
4
4
  "description": "Test utilities for Yeoman generators",
5
5
  "homepage": "http://yeoman.io/authoring/testing.html",
6
6
  "author": "The Yeoman Team",
@@ -47,10 +47,10 @@
47
47
  "inquirer": "^9.2.2",
48
48
  "lodash": "^4.17.21",
49
49
  "mem-fs": "^3.0.0",
50
- "mem-fs-editor": "^10.0.1",
50
+ "mem-fs-editor": "^10.0.2",
51
51
  "sinon": "^14.0.2",
52
52
  "temp-dir": "^3.0.0",
53
- "yeoman-generator": "^6.0.0-alpha.2"
53
+ "yeoman-generator": "^6.0.0-alpha.3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "yeoman-environment": "^3.13.0 || ^4.0.0-alpha.0"