Skip to content

Commit 1fd2185

Browse files
committed
refactor(tests): Combine tests to improve TD dev experience
Total test runtime is down to ~30 seconds, which is MUCH better than the ~3 minutes it used to be for consistantly running the tests during development.
1 parent 7152031 commit 1fd2185

File tree

152 files changed

+12473
-16305
lines changed

Some content is hidden

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

152 files changed

+12473
-16305
lines changed

.gitignore

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,10 @@ yarn.lock
77
.nyc_output
88
yarn-error.log
99

10-
/src/typings/typescript/typescript.js
11-
12-
/tmp/
13-
/etc/
1410
/examples/*/doc
1511
/examples/basic/json.json
16-
/examples/definitely-typed/src/
17-
/examples/plottable/src/
18-
/examples/doppio/src/
1912
/node_modules/
20-
/typescript/
2113
/coverage/
2214
/dist/
2315

24-
typedoc*.tgz
16+
typedoc*.tgz

examples/basic/src/access.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
* A variable that is made private via comment.
33
* @private
44
*/
5+
// tslint:disable-next-line:no-var-keyword
56
export var fakePrivateVariable = 'test';
67

78
/**
89
* A variable that is made protected via comment.
910
* @protected
1011
*/
11-
export var fakeProtectedVariable = 'test';
12+
export let fakeProtectedVariable = 'test';
1213

1314
/**
1415
* A function that is made private via comment.
@@ -26,19 +27,18 @@ export function fakeProtectedFunction() {}
2627
* A class that is documented as being private.
2728
* @private
2829
*/
29-
export class PrivateClass
30-
{
30+
export class PrivateClass {
3131
/**
3232
* A variable that is made private via comment.
3333
* @private
3434
*/
35-
fakePrivateVariable:string;
35+
fakePrivateVariable: string;
3636

3737
/**
3838
* A variable that is made protected via comment.
3939
* @protected
4040
*/
41-
fakeProtectedVariable:string;
41+
fakeProtectedVariable: string;
4242

4343
/**
4444
* A function that is made private via comment.
@@ -57,7 +57,6 @@ export class PrivateClass
5757
* A module that is documented as being private.
5858
* @private
5959
*/
60-
export module PrivateModule
61-
{
60+
export module PrivateModule {
6261
export function functionInsidePrivateModule() {}
63-
}
62+
}

examples/basic/src/classes.ts

Lines changed: 47 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,78 @@
11
/**
22
* This is a simple interface.
33
*/
4-
export interface INameInterface
5-
{
4+
export interface NameInterface {
65
/**
76
* This is a interface member of INameInterface.
87
*
98
* It should be inherited by all subinterfaces.
109
*/
11-
name:string;
10+
name: string;
1211

1312
/**
1413
* This is a interface function of INameInterface.
1514
*
1615
* It should be inherited by all subinterfaces.
1716
*/
18-
getName():string;
17+
getName(): string;
1918
}
2019

21-
2220
/**
2321
* This is a simple interface.
2422
*/
25-
export interface IPrintInterface
26-
{
23+
export interface PrintInterface {
2724
/**
2825
* This is a interface function of IPrintInterface
2926
*
3027
* It should be inherited by all subinterfaces.
3128
*/
32-
print(value:string):void;
29+
print(value: string): void;
3330
}
3431

35-
3632
/**
3733
* This is a interface inheriting from two other interfaces.
3834
*/
39-
export interface IPrintNameInterface extends INameInterface, IPrintInterface
40-
{
35+
export interface PrintNameInterface extends NameInterface, PrintInterface {
4136
/**
4237
* This is a interface function of IPrintNameInterface
4338
*/
44-
printName():void;
39+
printName(): void;
4540
}
4641

47-
4842
/**
4943
* This is a simple base class.
5044
*
5145
* [[include:class-example.md]]
5246
*/
53-
export abstract class BaseClass implements INameInterface
54-
{
47+
export abstract class BaseClass implements NameInterface {
5548
/**
5649
* This is a simple public member.
5750
*/
58-
public name:string;
51+
public name: string;
5952

6053
/**
6154
* This is a simple protected member.
6255
*/
63-
protected kind:number;
56+
protected kind: number;
6457

6558
/**
6659
* This is a static member.
6760
*
6861
* Static members should not be inherited.
6962
*/
70-
static instance:BaseClass;
71-
static instances:BaseClass[];
63+
static instance: BaseClass;
64+
static instances: BaseClass[];
7265

7366
/**
7467
* This is an instance member of an internal class.
7568
*/
76-
private internalClass:InternalClass<keyof BaseClass>;
69+
private internalClass: InternalClass<keyof BaseClass>;
7770

78-
79-
constructor(name:string);
80-
constructor(source:BaseClass);
71+
constructor(name: string);
72+
constructor(source: BaseClass);
8173
constructor() {
8274
if (arguments.length > 0) {
83-
if (typeof arguments[0] == 'string') {
75+
if (typeof arguments[0] === 'string') {
8476
this.name = arguments[0];
8577
} else if (arguments[0] instanceof BaseClass) {
8678
this.name = arguments[0].name;
@@ -100,11 +92,10 @@ export abstract class BaseClass implements INameInterface
10092
*
10193
* @returns Return the name.
10294
*/
103-
public getName():string {
95+
public getName(): string {
10496
return this.name;
10597
}
10698

107-
10899
/**
109100
* This is a simple static member function.
110101
*
@@ -113,24 +104,22 @@ export abstract class BaseClass implements INameInterface
113104
*
114105
* @returns Return the name.
115106
*/
116-
static getName():string {
107+
static getName(): string {
117108
return 'A name';
118109
}
119110

120-
121111
/**
122112
* This is a simple member function.
123113
*
124114
* It should be inherited by all subclasses.
125115
*
126116
* @param name The new name.
127117
*/
128-
public setName(name:string) {
118+
public setName(name: string) {
129119
this.name = name;
130120
this.checkName();
131121
}
132122

133-
134123
/**
135124
* This is a simple fat arrow function.
136125
*
@@ -139,8 +128,7 @@ export abstract class BaseClass implements INameInterface
139128
* @see https://github.com/sebastian-lenz/typedoc/issues/37
140129
*/
141130
public arrowFunction = (param2: string, param1: number): void => {
142-
};
143-
131+
}
144132

145133
/**
146134
* This is a private function.
@@ -149,30 +137,28 @@ export abstract class BaseClass implements INameInterface
149137
return true;
150138
}
151139

152-
153140
/**
154141
* This is a static function.
155142
*
156143
* Static functions should not be inherited.
157144
*
158145
* @returns An instance of BaseClass.
159146
*/
160-
static getInstance():BaseClass {
147+
static getInstance(): BaseClass {
161148
return BaseClass.instance;
162149
}
163150

164-
165151
/**
166152
* @see https://github.com/sebastian-lenz/typedoc/issues/42
167153
*/
168-
public static caTest(originalValues:BaseClass, newRecord: any, fieldNames:string[], mandatoryFields:string[]): string {
169-
var returnval = "";
170-
var updates: string[] = [];
171-
var allFields: string[] = fieldNames;
172-
for (var j = 0; j < allFields.length; j++) {
173-
var field = allFields[j];
174-
var oldValue = originalValues[field];
175-
var newValue = newRecord[field];
154+
public static caTest(originalValues: BaseClass, newRecord: any, fieldNames: string[], mandatoryFields: string[]): string {
155+
let returnval = '';
156+
let updates: string[] = [];
157+
let allFields: string[] = fieldNames;
158+
for (let j = 0; j < allFields.length; j++) {
159+
let field = allFields[j];
160+
let oldValue = originalValues[field];
161+
let newValue = newRecord[field];
176162
}
177163
return returnval;
178164
}
@@ -181,9 +167,8 @@ export abstract class BaseClass implements INameInterface
181167
/**
182168
* This is an internal class, it is not exported.
183169
*/
184-
class InternalClass<TTT extends keyof BaseClass>
185-
{
186-
constructor(options:{name:string}) {
170+
class InternalClass<TTT extends keyof BaseClass> {
171+
constructor(options: {name: string}) {
187172

188173
}
189174
}
@@ -194,19 +179,18 @@ class InternalClass<TTT extends keyof BaseClass>
194179
* This class has no own constructor, so its constructor should be inherited
195180
* from BaseClass.
196181
*/
197-
export class SubClassA extends BaseClass implements IPrintNameInterface
198-
{
199-
public name:string;
182+
export class SubClassA extends BaseClass implements PrintNameInterface {
183+
public name: string;
200184

201185
/**
202186
* This is a simple interface function.
203187
*/
204-
public print(value:string):void { }
188+
public print(value: string): void { }
205189

206190
/**
207191
* @inheritdoc
208192
*/
209-
public printName():void {
193+
public printName(): void {
210194
this.print(this.getName());
211195
}
212196

@@ -215,7 +199,7 @@ export class SubClassA extends BaseClass implements IPrintNameInterface
215199
*
216200
* @returns The return value.
217201
*/
218-
public get nameProperty():string {
202+
public get nameProperty(): string {
219203
return this.name;
220204
}
221205

@@ -225,7 +209,7 @@ export class SubClassA extends BaseClass implements IPrintNameInterface
225209
* @param value The new name.
226210
* @returns The return value.
227211
*/
228-
public set nameProperty(value:string) {
212+
public set nameProperty(value: string) {
229213
this.name = value;
230214
}
231215

@@ -234,7 +218,7 @@ export class SubClassA extends BaseClass implements IPrintNameInterface
234218
*
235219
* @returns The return value.
236220
*/
237-
public get readOnlyNameProperty():string {
221+
public get readOnlyNameProperty(): string {
238222
return this.name;
239223
}
240224

@@ -244,7 +228,7 @@ export class SubClassA extends BaseClass implements IPrintNameInterface
244228
* @param value The new name.
245229
* @returns The return value.
246230
*/
247-
public set writeOnlyNameProperty(value:string) {
231+
public set writeOnlyNameProperty(value: string) {
248232
this.name = value;
249233
}
250234

@@ -258,19 +242,18 @@ export class SubClassA extends BaseClass implements IPrintNameInterface
258242
*
259243
* The constructor of the original class should be overwritten.
260244
*/
261-
export class SubClassB extends BaseClass
262-
{
245+
export class SubClassB extends BaseClass {
263246
public name: string;
264247

265-
constructor(name:string) {
248+
constructor(name: string) {
266249
super(name);
267250
}
268251

269252
abstractMethod(): void {
270253

271254
}
272255

273-
doSomething(value:[string, SubClassA, SubClassB]) {
256+
doSomething(value: [string, SubClassA, SubClassB]) {
274257
}
275258
}
276259

@@ -279,9 +262,8 @@ export class SubClassB extends BaseClass
279262
*
280263
* @param T This a type parameter.
281264
*/
282-
export class GenericClass<T extends BaseClass>
283-
{
284-
public value:T;
265+
export class GenericClass<T extends BaseClass> {
266+
public value: T;
285267

286268
/**
287269
* Constructor short text.
@@ -292,17 +274,17 @@ export class GenericClass<T extends BaseClass>
292274
* @param p4 Public implicit any property
293275
* @param p5 Readonly property
294276
*/
295-
constructor(p1, protected p2:T, public p3:number, private p4:number, readonly p5: string) {
277+
constructor(p1, protected p2: T, public p3: number, private p4: number, readonly p5: string) {
296278
}
297279

298280
/**
299281
* @param value [[getValue]] is the counterpart.
300282
*/
301-
public setValue(value:T) {
283+
public setValue(value: T) {
302284
this.value = value;
303285
}
304286

305-
public getValue():T {
287+
public getValue(): T {
306288
return this.value;
307289
}
308290
}

0 commit comments

Comments
 (0)