mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
refactor(test): use more specific checks in check-tsconfig spec (#398)
- `toBeFalsy()` was a bit imprecise and always felt as such, especially since `checkTsConfig` returns `void` - so instead check that it doesn't throw, which matches the test _intent_ - reorder the tests a bit to match existing test style: non-errors first, then errors - and separating into two different test blocks parallelizes them as well - also add an ES2020 check as well (follow-up to eb1dd17babde0b22e9540b12e671eb56d9d6bce0)
This commit is contained in:
parent
d286015ad2
commit
576558e082
@ -10,19 +10,24 @@ const defaultConfig = { fileNames: [], errors: [], options: {} };
|
||||
|
||||
test("checkTsConfig", () => {
|
||||
expect(() => checkTsConfig({
|
||||
...defaultConfig,
|
||||
options: { module: ts.ModuleKind.None },
|
||||
})).toThrow(
|
||||
"Incompatible tsconfig option. Module resolves to 'None'. This is incompatible with Rollup, please use",
|
||||
);
|
||||
|
||||
expect(checkTsConfig({
|
||||
...defaultConfig,
|
||||
options: { module: ts.ModuleKind.ES2015 },
|
||||
})).toBeFalsy();
|
||||
})).not.toThrow();
|
||||
|
||||
expect(checkTsConfig({
|
||||
expect(() => checkTsConfig({
|
||||
...defaultConfig,
|
||||
options: { module: ts.ModuleKind.ES2020 },
|
||||
})).not.toThrow();
|
||||
|
||||
expect(() => checkTsConfig({
|
||||
...defaultConfig,
|
||||
options: { module: ts.ModuleKind.ESNext },
|
||||
})).toBeFalsy();
|
||||
})).not.toThrow();
|
||||
});
|
||||
|
||||
test("checkTsConfig - errors", () => {
|
||||
expect(() => checkTsConfig({
|
||||
...defaultConfig,
|
||||
options: { module: ts.ModuleKind.None },
|
||||
})).toThrow("Incompatible tsconfig option. Module resolves to 'None'. This is incompatible with Rollup, please use");
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user