Skip to content

Commit

Permalink
fix: don't duplicate type-only check on Windows (#385)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
agilgur5 committed Jul 21, 2022
1 parent eab48a3 commit c2b3db2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions __tests__/integration/errors.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c2b3db2

Please sign in to comment.