fix: don't duplicate type-only check on Windows (#385)

- gotta remember to normalize file names 🙃
  - this fixes a failing test on Windows by fixing the underlying bug

- refactor: improve normalization in errors.spec
  - normalize _all_ calls to `local`, instead of just one
  - this doesn't affect the tests, only the source code change does, but I added this first and it's better practice / test future-proofing
This commit is contained in:
Anton Gilgur 2022-07-21 14:15:15 -04:00 committed by GitHub
parent eab48a3951
commit c2b3db2300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import * as helpers from "./helpers";
// increase timeout to 15s for whole file since CI occassionally timed out -- these are integration and cache tests, so longer timeout is warranted
jest.setTimeout(15000);
const local = (x: string) => path.resolve(__dirname, x);
const local = (x: string) => normalize(path.resolve(__dirname, x));
const cacheRoot = local("__temp/errors/rpt2-cache"); // don't use the one in node_modules
afterAll(async () => {
@ -20,7 +20,7 @@ afterAll(async () => {
});
async function genBundle(relInput: string, extraOpts?: RPT2Options, onwarn?: Mock) {
const input = normalize(local(`fixtures/errors/${relInput}`));
const input = local(`fixtures/errors/${relInput}`);
return helpers.genBundle({
input,
tsconfig: local("fixtures/errors/tsconfig.json"),

View File

@ -56,6 +56,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
const typecheckFile = (id: string, snapshot: tsTypes.IScriptSnapshot, tcContext: IContext) =>
{
id = normalize(id);
checkedFiles.add(id); // must come before print, as that could bail
const diagnostics = getDiagnostics(id, snapshot);