yeoman-test 8.0.0-alpha.3 → 8.0.0-beta.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/helpers.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import GeneratorImplementation, { type StorageRecord, type BaseOptions as GeneratorOptions } from 'yeoman-generator';
1
+ import GeneratorImplementation from 'yeoman-generator';
2
2
  import Environment from 'yeoman-environment';
3
3
  import type { createEnv } from 'yeoman-environment';
4
- import type { BaseEnvironmentOptions, BaseGenerator, GetGeneratorConstructor, PromptAnswers } from '@yeoman/types';
4
+ import type { BaseEnvironmentOptions, BaseGenerator, GeneratorBaseOptions, GetGeneratorConstructor, GetGeneratorOptions, PromptAnswers } from '@yeoman/types';
5
5
  import type { SinonSpiedInstance } from 'sinon';
6
6
  import { type DummyPromptOptions } from './adapter.js';
7
7
  import RunContext, { BasicRunContext, type RunContextSettings } from './run-context.js';
@@ -17,7 +17,7 @@ export type GeneratorFactory<GenParameter extends BaseGenerator = GeneratorImple
17
17
  export declare class YeomanTest {
18
18
  settings?: RunContextSettings;
19
19
  environmentOptions?: BaseEnvironmentOptions;
20
- generatorOptions?: GeneratorOptions;
20
+ generatorOptions?: GeneratorBaseOptions;
21
21
  /**
22
22
  * @deprecated
23
23
  * Create a function that will clean up the test directory,
@@ -64,7 +64,7 @@ export declare class YeomanTest {
64
64
  * @param generator - a Yeoman generator
65
65
  * @param localConfig - localConfig - should look just like if called config.getAll()
66
66
  */
67
- mockLocalConfig(generator: BaseGenerator, localConfig: StorageRecord): void;
67
+ mockLocalConfig(generator: BaseGenerator, localConfig: any): void;
68
68
  /**
69
69
  * Create a mocked generator
70
70
  */
@@ -92,7 +92,7 @@ export declare class YeomanTest {
92
92
  * ];
93
93
  * var angular = createGenerator('angular:app', deps);
94
94
  */
95
- createGenerator<GeneratorType extends BaseGenerator = GeneratorImplementation>(name: string, dependencies: Dependency[], args?: string[], options?: GeneratorOptions, localConfigOnly?: boolean): Promise<GeneratorType>;
95
+ createGenerator<GeneratorType extends BaseGenerator = GeneratorImplementation>(name: string, dependencies: Dependency[], args?: string[], options?: GetGeneratorOptions<GeneratorType>, localConfigOnly?: boolean): Promise<GeneratorType>;
96
96
  /**
97
97
  * @deprecated
98
98
  * Register a list of dependent generators into the provided env.
@@ -145,7 +145,7 @@ export declare class YeomanTest {
145
145
  * Prepare temporary dir without generator support.
146
146
  * Generator and environment will be undefined.
147
147
  */
148
- prepareTemporaryDir(settings?: RunContextSettings): BasicRunContext;
148
+ prepareTemporaryDir(settings?: RunContextSettings): BasicRunContext<BaseGenerator>;
149
149
  }
150
150
  declare const defaultHelpers: YeomanTest;
151
151
  export default defaultHelpers;
@@ -4,8 +4,6 @@ import { type Store } from 'mem-fs';
4
4
  import type { BaseEnvironmentOptions, BaseGenerator, GetGeneratorConstructor, GetGeneratorOptions, PromptAnswers } from '@yeoman/types';
5
5
  import type Environment from 'yeoman-environment';
6
6
  import { type LookupOptions } from 'yeoman-environment';
7
- import type GeneratorImplementation from 'yeoman-generator';
8
- import type { StorageRecord } from 'yeoman-generator';
9
7
  import { type MemFsEditor, type VinylMemFsEditorFile } from 'mem-fs-editor';
10
8
  import RunResult, { type RunResultOptions } from './run-result.js';
11
9
  import { type Dependency, type YeomanTest, type GeneratorFactory } from './helpers.js';
@@ -35,11 +33,11 @@ export type RunContextSettings = {
35
33
  namespace?: string;
36
34
  };
37
35
  type PromiseRunResult<GeneratorType extends BaseGenerator> = Promise<RunResult<GeneratorType>>;
38
- type MockedGeneratorFactory = <GenParameter extends BaseGenerator = GeneratorImplementation>(GeneratorClass?: GetGeneratorConstructor<GenParameter>) => GenParameter;
36
+ type MockedGeneratorFactory<GenParameter extends BaseGenerator = BaseGenerator> = (GeneratorClass?: GetGeneratorConstructor<GenParameter>) => GenParameter;
39
37
  type EnvOptions = BaseEnvironmentOptions & {
40
38
  createEnv?: any;
41
39
  };
42
- export declare class RunContextBase<GeneratorType extends BaseGenerator = GeneratorImplementation> extends EventEmitter {
40
+ export declare class RunContextBase<GeneratorType extends BaseGenerator = BaseGenerator> extends EventEmitter {
43
41
  readonly mockedGenerators: Record<string, BaseGenerator>;
44
42
  env: Environment;
45
43
  generator: GeneratorType;
@@ -221,7 +219,7 @@ export declare class RunContextBase<GeneratorType extends BaseGenerator = Genera
221
219
  * Mock the local configuration with the provided config
222
220
  * @param localConfig - should look just like if called config.getAll()
223
221
  */
224
- withLocalConfig(localConfig: StorageRecord): this;
222
+ withLocalConfig(localConfig: any): this;
225
223
  /**
226
224
  * Don't reset mem-fs state cleared to aggregate snapshots from multiple runs.
227
225
  */
@@ -294,13 +292,13 @@ export declare class RunContextBase<GeneratorType extends BaseGenerator = Genera
294
292
  */
295
293
  private setDir;
296
294
  }
297
- export default class RunContext<GeneratorType extends BaseGenerator = GeneratorImplementation> extends RunContextBase<GeneratorType> implements Promise<RunResult<GeneratorType>> {
295
+ export default class RunContext<GeneratorType extends BaseGenerator = BaseGenerator> extends RunContextBase<GeneratorType> implements Promise<RunResult<GeneratorType>> {
298
296
  then<TResult1 = RunResult<GeneratorType>, TResult2 = never>(onfulfilled?: ((value: RunResult<GeneratorType>) => TResult1 | PromiseLike<TResult1>) | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined): Promise<TResult1 | TResult2>;
299
297
  catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined): Promise<RunResult<GeneratorType> | TResult>;
300
298
  finally(onfinally?: (() => void) | undefined): Promise<RunResult<GeneratorType>>;
301
299
  get [Symbol.toStringTag](): string;
302
300
  }
303
- export declare class BasicRunContext extends RunContext {
301
+ export declare class BasicRunContext<GeneratorType extends BaseGenerator = BaseGenerator> extends RunContext<GeneratorType> {
304
302
  run(): PromiseRunResult<any>;
305
303
  }
306
304
  export {};
@@ -37,7 +37,7 @@ export type RunResultOptions<GeneratorType extends BaseGenerator> = {
37
37
  /**
38
38
  * This class provides utilities for testing generated content.
39
39
  */
40
- export default class RunResult<GeneratorType extends BaseGenerator = GeneratorImplementation> {
40
+ export default class RunResult<GeneratorType extends BaseGenerator = BaseGenerator> {
41
41
  env: any;
42
42
  generator: GeneratorType;
43
43
  cwd: string;
@@ -1,8 +1,7 @@
1
- import type { BaseGenerator } from '@yeoman/types';
2
1
  import type RunContext from './run-context.js';
3
2
  import type RunResult from './run-result.js';
4
3
  declare class TestContext {
5
- runResult?: RunResult<BaseGenerator>;
4
+ runResult?: RunResult;
6
5
  private runContext?;
7
6
  startNewContext(runContext?: RunContext<any>): void;
8
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeoman-test",
3
- "version": "8.0.0-alpha.3",
3
+ "version": "8.0.0-beta.0",
4
4
  "description": "Test utilities for Yeoman generators",
5
5
  "homepage": "http://yeoman.io/authoring/testing.html",
6
6
  "author": "The Yeoman Team",
@@ -50,7 +50,7 @@
50
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.3"
53
+ "yeoman-generator": "^6.0.0-alpha.4"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "yeoman-environment": "^3.13.0 || ^4.0.0-alpha.0"