Skip to content

Commit

Permalink
Fix path display in not exported warnings
Browse files Browse the repository at this point in the history
Resolves #1738
  • Loading branch information
Gerrit0 committed Oct 16, 2021
1 parent b878a9b commit fbf198e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@
- Fixed improper quoting of `as const` style enums, #1727.
- Fixed handling of `@typeParam` on type aliases, #1733.
- Fixed handling of comment tags on function type aliases, #1734.
- Paths in warnings about non-exported symbols are now consistently displayed across platforms, #1738.

### Thanks!

Expand Down
7 changes: 3 additions & 4 deletions src/lib/validation/exports.ts
Expand Up @@ -10,7 +10,7 @@ import {
SignatureReflection,
TypeParameterReflection,
} from "../models";
import type { Logger } from "../utils";
import { Logger, normalizePath } from "../utils";

function makeIntentionallyExportedHelper(
intentional: readonly string[],
Expand Down Expand Up @@ -100,9 +100,8 @@ export function validateExports(
decl.getSourceFile(),
decl.getStart()
);
const file = relative(
process.cwd(),
decl.getSourceFile().fileName
const file = normalizePath(
relative(process.cwd(), decl.getSourceFile().fileName)
);

logger.warn(
Expand Down
7 changes: 2 additions & 5 deletions src/test/validation.test.ts
@@ -1,5 +1,5 @@
import { equal, fail, ok } from "assert";
import { join, relative } from "path";
import { join } from "path";
import { Logger, LogLevel } from "..";
import { validateExports } from "../lib/validation/exports";
import { getConverter2App, getConverter2Program } from "./programs";
Expand Down Expand Up @@ -38,10 +38,7 @@ function expectWarning(
equal(match[1], typeName, "Missing type name is different.");
equal(
match[2],
relative(
process.cwd(),
join(__dirname, "converter2/validation", file)
),
`dist/test/converter2/validation/${file}`,
"Referencing file is different."
);
equal(
Expand Down

0 comments on commit fbf198e

Please sign in to comment.