yeoman-test 11.2.0 → 11.3.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.js +4 -4
- package/dist/run-result.d.ts +5 -8
- package/dist/run-result.js +1 -1
- package/package.json +17 -19
package/dist/run-context.js
CHANGED
|
@@ -247,7 +247,7 @@ export class RunContextBase extends EventEmitter {
|
|
|
247
247
|
*/
|
|
248
248
|
withArguments(arguments_) {
|
|
249
249
|
const argumentsArray = typeof arguments_ === 'string' ? arguments_.split(' ') : arguments_;
|
|
250
|
-
assert(Array.isArray(argumentsArray), 'args should be either a string separated by spaces or an array');
|
|
250
|
+
assert.ok(Array.isArray(argumentsArray), 'args should be either a string separated by spaces or an array');
|
|
251
251
|
this.args = [...this.args, ...argumentsArray];
|
|
252
252
|
return this;
|
|
253
253
|
}
|
|
@@ -309,7 +309,7 @@ export class RunContextBase extends EventEmitter {
|
|
|
309
309
|
* });
|
|
310
310
|
*/
|
|
311
311
|
withGenerators(dependencies) {
|
|
312
|
-
assert(Array.isArray(dependencies), 'dependencies should be an array');
|
|
312
|
+
assert.ok(Array.isArray(dependencies), 'dependencies should be an array');
|
|
313
313
|
return this.onEnvironment(async (environment) => {
|
|
314
314
|
for (const dependency of dependencies) {
|
|
315
315
|
if (typeof dependency === 'string') {
|
|
@@ -381,7 +381,7 @@ export class RunContextBase extends EventEmitter {
|
|
|
381
381
|
.calledOnce));
|
|
382
382
|
*/
|
|
383
383
|
withMockedGenerators(namespaces) {
|
|
384
|
-
assert(Array.isArray(namespaces), 'namespaces should be an array');
|
|
384
|
+
assert.ok(Array.isArray(namespaces), 'namespaces should be an array');
|
|
385
385
|
const mockedGenerators = Object.fromEntries(namespaces.map(namespace => [namespace, this.mockedGeneratorFactory()]));
|
|
386
386
|
const dependencies = Object.entries(mockedGenerators).map(([namespace, mock]) => [mock, { namespace }]);
|
|
387
387
|
Object.assign(this.mockedGenerators, mockedGenerators);
|
|
@@ -392,7 +392,7 @@ export class RunContextBase extends EventEmitter {
|
|
|
392
392
|
* @param localConfig - should look just like if called config.getAll()
|
|
393
393
|
*/
|
|
394
394
|
withLocalConfig(localConfig) {
|
|
395
|
-
assert(typeof localConfig === 'object', 'config should be an object');
|
|
395
|
+
assert.ok(typeof localConfig === 'object', 'config should be an object');
|
|
396
396
|
return this.onGenerator(generator => generator.config.defaults(localConfig));
|
|
397
397
|
}
|
|
398
398
|
/**
|
package/dist/run-result.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import type { DefaultEnvironmentApi } from '../types/type-helpers.js';
|
|
|
6
6
|
import { type RunContextSettings } from './run-context.js';
|
|
7
7
|
import { type YeomanTest } from './helpers.js';
|
|
8
8
|
import { type AskedQuestions } from './adapter.js';
|
|
9
|
+
import { ValueOf } from 'type-fest';
|
|
10
|
+
type MemFsEditorDumpFile = ValueOf<ReturnType<MemFsEditor['dump']>>;
|
|
9
11
|
/**
|
|
10
12
|
* Provides options for `RunResult`s.
|
|
11
13
|
*/
|
|
@@ -63,18 +65,12 @@ export default class RunResult<GeneratorType extends BaseGenerator = BaseGenerat
|
|
|
63
65
|
* Return an object with fs changes.
|
|
64
66
|
* @param {Function} filter - parameter forwarded to mem-fs-editor#dump
|
|
65
67
|
*/
|
|
66
|
-
getSnapshot(filter?: Parameters<MemFsEditor['dump']>[1]): Record<string,
|
|
67
|
-
contents: string;
|
|
68
|
-
stateCleared: string;
|
|
69
|
-
}>;
|
|
68
|
+
getSnapshot(filter?: Parameters<MemFsEditor['dump']>[1]): Record<string, MemFsEditorDumpFile>;
|
|
70
69
|
/**
|
|
71
70
|
* Return an object with filenames with state.
|
|
72
71
|
* @param {Function} filter - parameter forwarded to mem-fs-editor#dump
|
|
73
72
|
*/
|
|
74
|
-
getStateSnapshot(filter?: Parameters<MemFsEditor['dump']>[1]): Record<string,
|
|
75
|
-
stateCleared?: string;
|
|
76
|
-
state?: string;
|
|
77
|
-
}>;
|
|
73
|
+
getStateSnapshot(filter?: Parameters<MemFsEditor['dump']>[1]): Record<string, Omit<MemFsEditorDumpFile, 'contents'>>;
|
|
78
74
|
/**
|
|
79
75
|
* Either dumps the contents of the specified files or the name and the contents of each file to the console.
|
|
80
76
|
*/
|
|
@@ -251,3 +247,4 @@ export default class RunResult<GeneratorType extends BaseGenerator = BaseGenerat
|
|
|
251
247
|
*/
|
|
252
248
|
getComposedGenerators(): string[];
|
|
253
249
|
}
|
|
250
|
+
export {};
|
package/dist/run-result.js
CHANGED
|
@@ -184,7 +184,7 @@ export default class RunResult {
|
|
|
184
184
|
const body = this._readFile(file);
|
|
185
185
|
let match = false;
|
|
186
186
|
match = typeof regex === 'string' ? body.includes(regex) : regex.test(body);
|
|
187
|
-
assert(match, `${file} did not match '${regex}'. Contained:\n\n${body}`);
|
|
187
|
+
assert.ok(match, `${file} did not match '${regex}'. Contained:\n\n${body}`);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
assertEqualsFileContent(...arguments_) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yeoman-test",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Test utilities for Yeoman generators",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yeoman",
|
|
@@ -44,28 +44,26 @@
|
|
|
44
44
|
"doc_path": "../yeoman-test-doc"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"lodash-es": "^4.17.
|
|
48
|
-
"mem-fs-editor": "^
|
|
47
|
+
"lodash-es": "^4.17.23",
|
|
48
|
+
"mem-fs-editor": "^12.0.2",
|
|
49
49
|
"signal-exit": "^4.1.0",
|
|
50
|
-
"type-fest": "^5.
|
|
50
|
+
"type-fest": "^5.4.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/lodash-es": "^4.17.12",
|
|
54
|
-
"@types/node": "
|
|
55
|
-
"@vitest/coverage-v8": "^4.0.
|
|
56
|
-
"@yeoman/adapter": "^4.0.
|
|
57
|
-
"@yeoman/eslint": "0.
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"prettier": "^3.
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"yeoman-environment": "^5.0.0-beta.2",
|
|
68
|
-
"yeoman-generator": "^8.0.0-beta.6"
|
|
54
|
+
"@types/node": "^20.19.35",
|
|
55
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
56
|
+
"@yeoman/adapter": "^4.0.2",
|
|
57
|
+
"@yeoman/eslint": "^1.0.0",
|
|
58
|
+
"husky": "^9.1.7",
|
|
59
|
+
"jsdoc": "^4.0.5",
|
|
60
|
+
"lint-staged": "^16.3.0",
|
|
61
|
+
"prettier": "^3.8.1",
|
|
62
|
+
"prettier-plugin-packagejson": "^3.0.0",
|
|
63
|
+
"typescript": "^5.9.3",
|
|
64
|
+
"vitest": "^4.0.18",
|
|
65
|
+
"yeoman-environment": "^6.0.0",
|
|
66
|
+
"yeoman-generator": "^8.0.0-beta.8"
|
|
69
67
|
},
|
|
70
68
|
"peerDependencies": {
|
|
71
69
|
"@yeoman/adapter": "^1.6.0 || ^2.0.0 || ^3.0.0 || ^4.0.1",
|