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

Commit

Permalink
Merge branch 'release/v12.1.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
manuth committed Sep 7, 2022
2 parents fb60dad + f0085ff commit 333ee48
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 36 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## ExtendedYoGenerator [Unreleased]

[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.1...dev)
[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.2...dev)

## ExtendedYoGenerator v12.1.2
### Updated
- The `TestContext.ResetSettings` method to also reset the `destinationRoot` of the generator
- All dependencies

[Show differences](https://github.com/manuth/ExtendedYoGenerator/compare/v12.1.1...v12.1.2)

## ExtendedYoGenerator v12.1.1
### Updated
Expand Down
54 changes: 29 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@types/git-branch": "^2.0.2",
"@types/glob": "^8.0.0",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.14",
"@types/node": "^18.7.15",
"@types/npm-which": "^3.0.1",
"@types/ts-nameof": "^4.2.1",
"concurrently": "^7.3.0",
"concurrently": "^7.4.0",
"copy-and-watch": "^0.1.6",
"eslint": "^8.23.0",
"fs-extra": "^10.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/extended-yo-generator-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@manuth/extended-yo-generator-test",
"version": "12.1.1",
"version": "12.1.2",
"type": "module",
"description": "Provides tools for testing generators created using `@manuth/extended-yo-generator`",
"author": "Manuel Thalmann <[email protected]>",
Expand Down Expand Up @@ -41,7 +41,7 @@
"test": "mocha"
},
"dependencies": {
"@manuth/extended-yo-generator": "^12.1.1",
"@manuth/extended-yo-generator": "^12.1.2",
"@types/yeoman-test": "^4.0.3",
"comment-json": "^4.2.3",
"fs-extra": "^10.1.0",
Expand All @@ -57,7 +57,7 @@
"@types/inquirer": "^9.0.1",
"@types/lodash.clonedeep": "^4.5.7",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.14",
"@types/node": "^18.7.15",
"@types/ts-nameof": "^4.2.1",
"inquirer": "^9.1.1",
"mocha": "^10.0.0",
Expand Down
10 changes: 9 additions & 1 deletion packages/extended-yo-generator-test/src/TestContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
*/
private finishedContext: IRunContext<TGenerator> = null;

/**
* A backup of the destination root of the generator.
*/
private destinationRootBackup: string;

/**
* A backup of the settings of the generator.
*/
Expand Down Expand Up @@ -76,7 +81,9 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
{
this.finishedContext = this.ExecuteGenerator();
await this.finishedContext.toPromise();
this.settingsBackup = cloneDeep(this.finishedContext.generator.Settings);
let generator = this.finishedContext.generator;
this.destinationRootBackup = generator.destinationRoot();
this.settingsBackup = cloneDeep(generator.Settings);
}

return this.finishedContext.generator;
Expand Down Expand Up @@ -153,6 +160,7 @@ export class TestContext<TGenerator extends Generator<any, TOptions> = Generator
if (this.finishedContext !== null)
{
let generator = await this.Generator;
generator.destinationRoot(this.destinationRootBackup);

for (let key of Object.keys(generator.Settings))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { deepStrictEqual, doesNotReject, notDeepEqual, ok, strictEqual } from "node:assert";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { GeneratorSettingKey, IGeneratorSettings } from "@manuth/extended-yo-generator";
import { Generator, GeneratorSettingKey, IGeneratorSettings } from "@manuth/extended-yo-generator";
import { TempDirectory } from "@manuth/temp-files";
import inquirer from "inquirer";
import cloneDeep from "lodash.clonedeep";
import { Random } from "random-js";
Expand Down Expand Up @@ -124,6 +125,19 @@ export function TestContextTests(): void
notDeepEqual(generator.Settings, customizedSettings);
deepStrictEqual(generator.Settings, originalSettings);
});

test(
`Checking whether the \`${nameof<Generator>(g => g.destinationRoot)}\` is reset properly…`,
async () =>
{
let tempDir = new TempDirectory();
let generator = await testContext.Generator;
let destinationRoot = generator.destinationRoot();
generator.destinationRoot(tempDir.FullName);
strictEqual(generator.destinationRoot(), tempDir.FullName);
await testContext.ResetSettings();
strictEqual(generator.destinationRoot(), destinationRoot);
});
});

suite(
Expand Down
6 changes: 3 additions & 3 deletions packages/extended-yo-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@manuth/extended-yo-generator",
"version": "12.1.1",
"version": "12.1.2",
"type": "module",
"description": "An extended version of the Yeoman-Generator",
"author": "Manuel Thalmann <[email protected]>",
Expand Down Expand Up @@ -50,15 +50,15 @@
"yeoman-generator": "^5.7.0"
},
"devDependencies": {
"@manuth/extended-yo-generator-test": "^12.1.1",
"@manuth/extended-yo-generator-test": "^12.1.2",
"@manuth/package-json-editor": "^3.0.2",
"@manuth/temp-files": "^3.0.0",
"@manuth/typescript-languageservice-tester": "^5.0.0",
"@stdlib/utils-escape-regexp-string": "^0.0.9",
"@types/ejs": "^3.1.1",
"@types/fs-extra": "^9.0.13",
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.14",
"@types/node": "^18.7.15",
"@types/sinon": "^10.0.13",
"@types/ts-nameof": "^4.2.1",
"@types/yeoman-environment": "^2.10.8",
Expand Down

0 comments on commit 333ee48

Please sign in to comment.