yeoman-test 11.5.1 → 11.5.2

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
@@ -126,7 +126,7 @@ export declare class YeomanTest {
126
126
  * @param {Object} - Options to be passed to the environment
127
127
  * const env = createTestEnv(require('yeoman-environment').createEnv);
128
128
  */
129
- createTestEnv(environmentContructor?: CreateEnv, options?: EnvironmentOptions): Promise<BaseEnvironment>;
129
+ createTestEnv(environmentContructor?: CreateEnv, options?: EnvironmentOptions): Promise<DefaultEnvironmentApi>;
130
130
  /**
131
131
  * Creates a TestAdapter using helpers default options.
132
132
  */
@@ -263,9 +263,10 @@ export class RunContextBase extends EventEmitter {
263
263
  }
264
264
  // Add options as both kebab and camel case. This is to stay backward compatibles with
265
265
  // the switch we made to meow for options parsing.
266
+ const optionsAny = options;
266
267
  for (const key of Object.keys(options)) {
267
- options[camelCase(key)] = options[key];
268
- options[kebabCase(key)] = options[key];
268
+ optionsAny[camelCase(key)] = optionsAny[key];
269
+ optionsAny[kebabCase(key)] = optionsAny[key];
269
270
  }
270
271
  this.options = { ...this.options, ...options };
271
272
  return this;
@@ -290,7 +291,9 @@ export class RunContextBase extends EventEmitter {
290
291
  */
291
292
  withAnswers(answers, options) {
292
293
  this.answers = { ...this.answers, ...answers };
293
- Object.assign(this.adapterOptions, options);
294
+ if (options) {
295
+ this.withAdapterOptions(options);
296
+ }
294
297
  return this;
295
298
  }
296
299
  /**
@@ -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: any;
53
+ mockedGenerators: Record<string, BaseGenerator>;
54
54
  options: RunResultOptions<GeneratorType>;
55
55
  spawnStub?: any;
56
56
  readonly askedQuestions: AskedQuestions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-test",
3
- "version": "11.5.1",
3
+ "version": "11.5.2",
4
4
  "description": "Test utilities for Yeoman generators",
5
5
  "keywords": [
6
6
  "yeoman",
@@ -40,7 +40,7 @@
40
40
  "fix": "prettier . --write && eslint . --fix",
41
41
  "precommit": "lint-staged",
42
42
  "prepare": "npm run build && husky",
43
- "pretest": "eslint .",
43
+ "pretest": "eslint . && tsc -p tsconfig.spec.json",
44
44
  "test": "vitest run --coverage"
45
45
  },
46
46
  "config": {
@@ -3,15 +3,7 @@ import type GeneratorImplementation from 'yeoman-generator';
3
3
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
4
  // @ts-ignore
5
5
  import type EnvironmentImplementation from 'yeoman-environment';
6
- import type { IfAny } from 'type-fest';
6
+ import type { IsAny } from 'type-fest';
7
7
 
8
- export type DefaultGeneratorApi = IfAny<
9
- typeof GeneratorImplementation,
10
- BaseGenerator,
11
- typeof GeneratorImplementation extends BaseGenerator ? typeof GeneratorImplementation : BaseGenerator
12
- >;
13
- export type DefaultEnvironmentApi = IfAny<
14
- typeof EnvironmentImplementation,
15
- BaseEnvironment,
16
- typeof EnvironmentImplementation extends BaseEnvironment ? typeof EnvironmentImplementation : BaseEnvironment
17
- >;
8
+ export type DefaultGeneratorApi = IsAny<GeneratorImplementation> extends true ? BaseGenerator : GeneratorImplementation;
9
+ export type DefaultEnvironmentApi = IsAny<EnvironmentImplementation> extends true ? BaseEnvironment : EnvironmentImplementation;