Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit 333ee48

Browse files
committed
Merge branch 'release/v12.1.2' into main
2 parents fb60dad + f0085ff commit 333ee48

File tree

7 files changed

+69
-36
lines changed

7 files changed

+69
-36
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## ExtendedYoGenerator [Unreleased]
88

9-
[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.1...dev)
9+
[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.2...dev)
10+
11+
## ExtendedYoGenerator v12.1.2
12+
### Updated
13+
- The `TestContext.ResetSettings` method to also reset the `destinationRoot` of the generator
14+
- All dependencies
15+
16+
[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.1...v12.1.2)
1017

1118
## ExtendedYoGenerator v12.1.1
1219
### Updated

package-lock.json

Lines changed: 29 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
"@types/git-branch": "^2.0.2",
4444
"@types/glob": "^8.0.0",
4545
"@types/mocha": "^9.1.1",
46-
"@types/node": "^18.7.14",
46+
"@types/node": "^18.7.15",
4747
"@types/npm-which": "^3.0.1",
4848
"@types/ts-nameof": "^4.2.1",
49-
"concurrently": "^7.3.0",
49+
"concurrently": "^7.4.0",
5050
"copy-and-watch": "^0.1.6",
5151
"eslint": "^8.23.0",
5252
"fs-extra": "^10.1.0",

packages/extended-yo-generator-test/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@manuth/extended-yo-generator-test",
3-
"version": "12.1.1",
3+
"version": "12.1.2",
44
"type": "module",
55
"description": "Provides tools for testing generators created using `@manuth/extended-yo-generator`",
66
"author": "Manuel Thalmann <[email protected]>",
@@ -41,7 +41,7 @@
4141
"test": "mocha"
4242
},
4343
"dependencies": {
44-
"@manuth/extended-yo-generator": "^12.1.1",
44+
"@manuth/extended-yo-generator": "^12.1.2",
4545
"@types/yeoman-test": "^4.0.3",
4646
"comment-json": "^4.2.3",
4747
"fs-extra": "^10.1.0",
@@ -57,7 +57,7 @@
5757
"@types/inquirer": "^9.0.1",
5858
"@types/lodash.clonedeep": "^4.5.7",
5959
"@types/mocha": "^9.1.1",
60-
"@types/node": "^18.7.14",
60+
"@types/node": "^18.7.15",
6161
"@types/ts-nameof": "^4.2.1",
6262
"inquirer": "^9.1.1",
6363
"mocha": "^10.0.0",

packages/extended-yo-generator-test/src/TestContext.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
4141
*/
4242
private finishedContext: IRunContext<TGenerator> = null;
4343

44+
/**
45+
* A backup of the destination root of the generator.
46+
*/
47+
private destinationRootBackup: string;
48+
4449
/**
4550
* A backup of the settings of the generator.
4651
*/
@@ -76,7 +81,9 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
7681
{
7782
this.finishedContext = this.ExecuteGenerator();
7883
await this.finishedContext.toPromise();
79-
this.settingsBackup = cloneDeep(this.finishedContext.generator.Settings);
84+
let generator = this.finishedContext.generator;
85+
this.destinationRootBackup = generator.destinationRoot();
86+
this.settingsBackup = cloneDeep(generator.Settings);
8087
}
8188

8289
return this.finishedContext.generator;
@@ -153,6 +160,7 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
153160
if (this.finishedContext !== null)
154161
{
155162
let generator = await this.Generator;
163+
generator.destinationRoot(this.destinationRootBackup);
156164

157165
for (let key of Object.keys(generator.Settings))
158166
{

packages/extended-yo-generator-test/src/tests/TestContext.test.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { deepStrictEqual, doesNotReject, notDeepEqual, ok, strictEqual } from "node:assert";
22
import { join } from "node:path";
33
import { fileURLToPath } from "node:url";
4-
import { GeneratorSettingKey, IGeneratorSettings } from "@manuth/extended-yo-generator";
4+
import { Generator, GeneratorSettingKey, IGeneratorSettings } from "@manuth/extended-yo-generator";
5+
import { TempDirectory } from "@manuth/temp-files";
56
import inquirer from "inquirer";
67
import cloneDeep from "lodash.clonedeep";
78
import { Random } from "random-js";
@@ -124,6 +125,19 @@ export function TestContextTests(): void
124125
notDeepEqual(generator.Settings, customizedSettings);
125126
deepStrictEqual(generator.Settings, originalSettings);
126127
});
128+
129+
test(
130+
`Checking whether the \`${nameof<Generator>(g => g.destinationRoot)}\` is reset properly…`,
131+
async () =>
132+
{
133+
let tempDir = new TempDirectory();
134+
let generator = await testContext.Generator;
135+
let destinationRoot = generator.destinationRoot();
136+
generator.destinationRoot(tempDir.FullName);
137+
strictEqual(generator.destinationRoot(), tempDir.FullName);
138+
await testContext.ResetSettings();
139+
strictEqual(generator.destinationRoot(), destinationRoot);
140+
});
127141
});
128142

129143
suite(

packages/extended-yo-generator/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@manuth/extended-yo-generator",
3-
"version": "12.1.1",
3+
"version": "12.1.2",
44
"type": "module",
55
"description": "An extended version of the Yeoman-Generator",
66
"author": "Manuel Thalmann <[email protected]>",
@@ -50,15 +50,15 @@
5050
"yeoman-generator": "^5.7.0"
5151
},
5252
"devDependencies": {
53-
"@manuth/extended-yo-generator-test": "^12.1.1",
53+
"@manuth/extended-yo-generator-test": "^12.1.2",
5454
"@manuth/package-json-editor": "^3.0.2",
5555
"@manuth/temp-files": "^3.0.0",
5656
"@manuth/typescript-languageservice-tester": "^5.0.0",
5757
"@stdlib/utils-escape-regexp-string": "^0.0.9",
5858
"@types/ejs": "^3.1.1",
5959
"@types/fs-extra": "^9.0.13",
6060
"@types/mocha": "^9.1.1",
61-
"@types/node": "^18.7.14",
61+
"@types/node": "^18.7.15",
6262
"@types/sinon": "^10.0.13",
6363
"@types/ts-nameof": "^4.2.1",
6464
"@types/yeoman-environment": "^2.10.8",

0 commit comments

Comments
 (0)