Skip to content

Commit 56278ee

Browse files
committed
Improve refactorability of other projects' tests.
1 parent 379a48c commit 56278ee

File tree

53 files changed

+226
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+226
-186
lines changed

apps/api-extractor/src/analyzer/test/PackageMetadataManager.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function firstArgument(mockFn: jest.Mock): any {
3030

3131
/* eslint-disable @typescript-eslint/typedef */
3232

33-
describe('PackageMetadataManager', () => {
34-
describe('.writeTsdocMetadataFile()', () => {
33+
describe(PackageMetadataManager.name, () => {
34+
describe(PackageMetadataManager.writeTsdocMetadataFile.name, () => {
3535
const originalWriteFile = FileSystem.writeFile;
3636
const mockWriteFile: jest.Mock = jest.fn();
3737
beforeAll(() => {
@@ -50,7 +50,7 @@ describe('PackageMetadataManager', () => {
5050
});
5151
});
5252

53-
describe('.resolveTsdocMetadataPath()', () => {
53+
describe(PackageMetadataManager.resolveTsdocMetadataPath.name, () => {
5454
describe('when an empty tsdocMetadataPath is provided', () => {
5555
const tsdocMetadataPath: string = '';
5656
describe('given a package.json where the field "tsdocMetadata" is defined', () => {

apps/api-extractor/src/analyzer/test/SyntaxHelpers.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import { SyntaxHelpers } from '../SyntaxHelpers';
55

6-
describe('SyntaxHelpers', () => {
7-
test('.toAlphaNumericCamelCase()', () => {
6+
describe(SyntaxHelpers.name, () => {
7+
it(SyntaxHelpers.makeCamelCaseIdentifier.name, () => {
88
// prettier-ignore
99
const inputs:string[] = [
1010
'',

apps/api-extractor/src/api/test/ExtractorConfig-lookup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function expectEqualPaths(path1: string, path2: string): void {
1515
}
1616

1717
// Tests for expanding the "<lookup>" token for the "projectFolder" setting in api-extractor.json
18-
describe('ExtractorConfig-lookup', () => {
18+
describe(`${ExtractorConfig.name}.${ExtractorConfig.loadFileAndPrepare.name}`, () => {
1919
it.only('config-lookup1: looks up ./api-extractor.json', () => {
2020
const extractorConfig: ExtractorConfig = ExtractorConfig.loadFileAndPrepare(
2121
path.join(testDataFolder, 'config-lookup1/api-extractor.json')

apps/heft/src/pluginFramework/logging/test/FileError.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { FileError, FileErrorFormat } from '../FileError';
55

6-
describe('FileError', () => {
6+
describe(FileError.name, () => {
77
it('normalizes slashes in file paths', () => {
88
const error1: FileError = new FileError('message', 'path\\to\\file', 0);
99
expect(error1.filePath).toEqual('path/to/file');

apps/heft/src/utilities/subprocess/test/SubprocessRunnerBase.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { SubprocessRunnerBase } from '../SubprocessRunnerBase';
55
import { FileError } from '../../../pluginFramework/logging/FileError';
66

7-
describe('SubprocessRunnerBase', () => {
7+
describe(SubprocessRunnerBase.name, () => {
88
it(`${SubprocessRunnerBase.serializeForIpcMessage.name} correctly serializes objects`, () => {
99
expect(SubprocessRunnerBase.serializeForIpcMessage(1)).toMatchSnapshot();
1010
expect(SubprocessRunnerBase.serializeForIpcMessage(false)).toMatchSnapshot();

apps/rush-lib/src/cli/actions/test/AddAction.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { RushCommandLineParser } from '../../RushCommandLineParser';
88
import { AddAction } from '../AddAction';
99

1010
describe(AddAction.name, () => {
11-
describe(`basic "rush add" tests`, () => {
11+
describe('basic "rush add" tests', () => {
1212
let doRushAddMock: jest.SpyInstance;
1313
let oldExitCode: number | undefined;
1414
let oldArgs: string[];
@@ -28,7 +28,7 @@ describe(AddAction.name, () => {
2828
process.argv = oldArgs;
2929
});
3030

31-
describe(`'add' action`, () => {
31+
describe("'add' action", () => {
3232
it(`adds a dependency to just one repo in the workspace`, async () => {
3333
const startPath: string = `${__dirname}/addRepo`;
3434
const aPath: string = `${__dirname}/addRepo/a`;
@@ -53,7 +53,7 @@ describe(AddAction.name, () => {
5353
});
5454
});
5555

56-
describe(`'add' action with --all`, () => {
56+
describe("'add' action with --all", () => {
5757
it(`adds a dependency to all repos in the workspace`, async () => {
5858
const startPath: string = `${__dirname}/addRepo`;
5959
const aPath: string = `${__dirname}/addRepo/a`;

apps/rush-lib/src/cli/test/RushCommandLineParser.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe(RushCommandLineParser.name, () => {
9292
});
9393

9494
describe('in basic repo', () => {
95-
describe(`'build' action`, () => {
95+
describe("'build' action", () => {
9696
it(`executes the package's 'build' script`, async () => {
9797
const repoName: string = 'basicAndRunBuildActionRepo';
9898
const instance: IParserTestInstance = getCommandLineParserInstance(repoName, 'build');
@@ -124,7 +124,7 @@ describe(RushCommandLineParser.name, () => {
124124
});
125125
});
126126

127-
describe(`'rebuild' action`, () => {
127+
describe("'rebuild' action", () => {
128128
it(`executes the package's 'build' script`, async () => {
129129
const repoName: string = 'basicAndRunRebuildActionRepo';
130130
const instance: IParserTestInstance = getCommandLineParserInstance(repoName, 'rebuild');
@@ -157,8 +157,8 @@ describe(RushCommandLineParser.name, () => {
157157
});
158158
});
159159

160-
describe(`in repo with 'rebuild' command overridden`, () => {
161-
describe(`'build' action`, () => {
160+
describe("in repo with 'rebuild' command overridden", () => {
161+
describe("'build' action", () => {
162162
it(`executes the package's 'build' script`, async () => {
163163
const repoName: string = 'overrideRebuildAndRunBuildActionRepo';
164164
const instance: IParserTestInstance = getCommandLineParserInstance(repoName, 'build');
@@ -190,7 +190,7 @@ describe(RushCommandLineParser.name, () => {
190190
});
191191
});
192192

193-
describe(`'rebuild' action`, () => {
193+
describe("'rebuild' action", () => {
194194
it(`executes the package's 'rebuild' script`, async () => {
195195
const repoName: string = 'overrideRebuildAndRunRebuildActionRepo';
196196
const instance: IParserTestInstance = getCommandLineParserInstance(repoName, 'rebuild');
@@ -223,8 +223,8 @@ describe(RushCommandLineParser.name, () => {
223223
});
224224
});
225225

226-
describe(`in repo with 'rebuild' or 'build' partially set`, () => {
227-
describe(`'build' action`, () => {
226+
describe("in repo with 'rebuild' or 'build' partially set", () => {
227+
describe("'build' action", () => {
228228
it(`executes the package's 'build' script`, async () => {
229229
const repoName: string = 'overrideAndDefaultBuildActionRepo';
230230
const instance: IParserTestInstance = getCommandLineParserInstance(repoName, 'build');
@@ -255,7 +255,7 @@ describe(RushCommandLineParser.name, () => {
255255
});
256256
});
257257

258-
describe(`'rebuild' action`, () => {
258+
describe("'rebuild' action", () => {
259259
it(`executes the package's 'build' script`, async () => {
260260
// broken
261261
const repoName: string = 'overrideAndDefaultRebuildActionRepo';
@@ -288,7 +288,7 @@ describe(RushCommandLineParser.name, () => {
288288
});
289289
});
290290

291-
describe(`in repo with 'build' command overridden as a global command`, () => {
291+
describe("in repo with 'build' command overridden as a global command", () => {
292292
it(`throws an error when starting Rush`, async () => {
293293
const repoName: string = 'overrideBuildAsGlobalCommandRepo';
294294

@@ -300,7 +300,7 @@ describe(RushCommandLineParser.name, () => {
300300
});
301301
});
302302

303-
describe(`in repo with 'rebuild' command overridden as a global command`, () => {
303+
describe("in repo with 'rebuild' command overridden as a global command", () => {
304304
it(`throws an error when starting Rush`, async () => {
305305
const repoName: string = 'overrideRebuildAsGlobalCommandRepo';
306306

@@ -312,7 +312,7 @@ describe(RushCommandLineParser.name, () => {
312312
});
313313
});
314314

315-
describe(`in repo with 'build' command overridden with 'safeForSimultaneousRushProcesses=true'`, () => {
315+
describe("in repo with 'build' command overridden with 'safeForSimultaneousRushProcesses=true'", () => {
316316
it(`throws an error when starting Rush`, async () => {
317317
const repoName: string = 'overrideBuildWithSimultaneousProcessesRepo';
318318

@@ -324,7 +324,7 @@ describe(RushCommandLineParser.name, () => {
324324
});
325325
});
326326

327-
describe(`in repo with 'rebuild' command overridden with 'safeForSimultaneousRushProcesses=true'`, () => {
327+
describe("in repo with 'rebuild' command overridden with 'safeForSimultaneousRushProcesses=true'", () => {
328328
it(`throws an error when starting Rush`, async () => {
329329
const repoName: string = 'overrideRebuildWithSimultaneousProcessesRepo';
330330

apps/rush/src/test/MinimalRushConfiguration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as path from 'path';
55

66
import { MinimalRushConfiguration } from '../MinimalRushConfiguration';
77

8-
describe('MinimalRushConfiguration', () => {
8+
describe(MinimalRushConfiguration.name, () => {
99
afterEach(() => {
1010
jest.restoreAllMocks();
1111
});

build-tests/heft-jest-reporters-test/src/test/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { addThreeStars } from '..';
55

6-
describe('addThreeStars', () => {
6+
describe(addThreeStars.name, () => {
77
it('adds three stars', () => {
88
expect(addThreeStars('***Hello World')).toEqual('***Hello World***');
99
});

eslint/eslint-plugin-packlets/src/test/Path.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function relativeCaseInsensitive(from: string, to: string) {
1515
return toPosixPath(Path['_relativeCaseInsensitive'](toNativePath(from), toNativePath(to)));
1616
}
1717

18-
describe('Path', () => {
18+
describe(Path.name, () => {
1919
test('_detectCaseSensitive()', () => {
2020
// NOTE: To ensure these tests are deterministic, only use absolute paths
2121
expect(relativeCaseInsensitive('/', '/')).toEqual('');

0 commit comments

Comments
 (0)