mirror of
https://github.com/chenasraf/DefinitelyTyped-tools.git
synced 2026-05-18 01:49:03 +00:00
Format
This commit is contained in:
@@ -77,7 +77,11 @@ export function checkTsconfig(options: CompilerOptions, dt: DefinitelyTypedInfo
|
||||
const expected = mustHave[key];
|
||||
const actual = options[key];
|
||||
if (!deepEquals(expected, actual)) {
|
||||
throw new Error(`Expected compilerOptions[${JSON.stringify(key)}] === ${JSON.stringify(expected)}, but got ${JSON.stringify(actual)}`);
|
||||
throw new Error(
|
||||
`Expected compilerOptions[${JSON.stringify(key)}] === ${JSON.stringify(expected)}, but got ${JSON.stringify(
|
||||
actual
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,34 +30,31 @@ function testSingle(testDirectory: string) {
|
||||
|
||||
describe("dtslint", () => {
|
||||
const base = {
|
||||
"module": "commonjs" as any,
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
module: "commonjs" as any,
|
||||
lib: ["es6"],
|
||||
noImplicitAny: true,
|
||||
noImplicitThis: true,
|
||||
strictNullChecks: true,
|
||||
strictFunctionTypes: true,
|
||||
baseUrl: "../",
|
||||
typeRoots: ["../"],
|
||||
types: [],
|
||||
noEmit: true,
|
||||
forceConsistentCasingInFileNames: true
|
||||
};
|
||||
describe("checks", () => {
|
||||
it("disallows unknown compiler options", () => {
|
||||
expect(() => checkTsconfig({ ...base, completelyInvented: true }, { relativeBaseUrl: "../" }))
|
||||
.toThrow("Unexpected compiler option completelyInvented");
|
||||
expect(() => checkTsconfig({ ...base, completelyInvented: true }, { relativeBaseUrl: "../" })).toThrow(
|
||||
"Unexpected compiler option completelyInvented"
|
||||
);
|
||||
});
|
||||
it("allows exactOptionalPropertyTypes: true", () => {
|
||||
expect(checkTsconfig({ ...base, exactOptionalPropertyTypes: true }, { relativeBaseUrl: "../" }))
|
||||
.toBeFalsy();
|
||||
expect(checkTsconfig({ ...base, exactOptionalPropertyTypes: true }, { relativeBaseUrl: "../" })).toBeFalsy();
|
||||
});
|
||||
it("disallows exactOptionalPropertyTypes: false", () => {
|
||||
expect(() => checkTsconfig({ ...base, exactOptionalPropertyTypes: false }, { relativeBaseUrl: "../" }))
|
||||
.toThrow("When \"exactOptionalPropertyTypes\" is present, it must be set to `true`.");
|
||||
expect(() => checkTsconfig({ ...base, exactOptionalPropertyTypes: false }, { relativeBaseUrl: "../" })).toThrow(
|
||||
'When "exactOptionalPropertyTypes" is present, it must be set to `true`.'
|
||||
);
|
||||
});
|
||||
});
|
||||
describe("rules", () => {
|
||||
@@ -74,4 +71,3 @@ describe("dtslint", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user