-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
881cd89
commit d05243b
Showing
4 changed files
with
170 additions
and
72 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/initialization/initializeTypeScript/writeMultiTypeScriptConfig.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { InitializationImprovement } from "./improvements.js"; | ||
import { generateMultiTypeScriptConfig } from "./writeMultiTypeScriptConfig.js"; | ||
|
||
describe("writeMultiTypeScriptConfig", () => { | ||
it("creates multi TypeScript config", () => { | ||
const config = generateMultiTypeScriptConfig({ | ||
fileName: "typestat.json", | ||
improvements: new Set([ | ||
InitializationImprovement.MissingProperties, | ||
InitializationImprovement.NoImplicitAny, | ||
InitializationImprovement.NoImplicitThis, | ||
InitializationImprovement.NoInferableTypes, | ||
InitializationImprovement.StrictNullChecks, | ||
]), | ||
project: { filePath: "./tsconfig.json" }, | ||
testFiles: "test/**/*.{ts,tsx}", | ||
}); | ||
|
||
expect(config).toStrictEqual([ | ||
{ | ||
fixes: { | ||
incompleteTypes: true, | ||
noImplicitAny: true, | ||
noImplicitThis: true, | ||
noInferableTypes: true, | ||
strictNonNullAssertions: true, | ||
}, | ||
include: ["test/**/*.{ts,tsx}"], | ||
projectPath: "./tsconfig.json", | ||
types: { | ||
strictNullChecks: true, | ||
}, | ||
}, | ||
{ | ||
exclude: ["test/**/*.{ts,tsx}"], | ||
fixes: { | ||
incompleteTypes: true, | ||
noImplicitAny: true, | ||
noImplicitThis: true, | ||
noInferableTypes: true, | ||
}, | ||
projectPath: "./tsconfig.json", | ||
}, | ||
{ | ||
fixes: { | ||
incompleteTypes: true, | ||
noImplicitAny: true, | ||
noImplicitThis: true, | ||
noInferableTypes: true, | ||
}, | ||
include: ["test/**/*.{ts,tsx}"], | ||
projectPath: "./tsconfig.json", | ||
}, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/initialization/initializeTypeScript/writeSingleTypeScriptConfig.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { describe, expect, it } from "vitest"; | ||
|
||
import { InitializationImprovement } from "./improvements.js"; | ||
import { generateSingleTypeScriptConfig } from "./writeSingleTypeScriptConfig.js"; | ||
|
||
describe("writeMultiTypeScriptConfig", () => { | ||
it("creates multi TypeScript config", () => { | ||
const config = generateSingleTypeScriptConfig({ | ||
fileName: "typestat.json", | ||
improvements: new Set([InitializationImprovement.NoImplicitAny]), | ||
project: { filePath: "./tsconfig.json" }, | ||
}); | ||
|
||
expect(config).toStrictEqual({ | ||
fixes: { | ||
incompleteTypes: true, | ||
noImplicitAny: true, | ||
}, | ||
projectPath: "./tsconfig.json", | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters