Skip to content

Commit

Permalink
Normalize path for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hasundue committed Oct 23, 2023
1 parent c8ccb3b commit bfcf519
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/git_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class DenoCommandStub {
}
}

function normalizePath(path: string) {
return Deno.build.os === "windows" ? path.replaceAll("/", "\\") : path;
}

describe("commitAll()", () => {
let output: { path: string; content: string }[] = [];
let updates: DependencyUpdate[];
Expand Down Expand Up @@ -115,9 +119,8 @@ describe("commitAll()", () => {
'git commit -m "build(deps): update node-emoji"',
"git add test/fixtures/direct-import/mod.ts",
'git commit -m "build(deps): update deno.land/x/deno_graph"',
// "git add test/fixtures/direct-import/mod.ts test/fixtures/direct-import/lib.ts",
'git commit -m "build(deps): update deno.land/std"',
],
].map(normalizePath),
);
});

Expand All @@ -134,7 +137,7 @@ describe("commitAll()", () => {
'git commit -m "build(deps): update test/fixtures/direct-import/mod.ts"',
"git add test/fixtures/direct-import/lib.ts",
'git commit -m "build(deps): update test/fixtures/direct-import/lib.ts"',
],
].map(normalizePath),
);
});
});
2 changes: 1 addition & 1 deletion lib/uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const URI = {
return relative(URI.cwd, uri) as RelativePath;
},
absolute(uri: URI<"file">): AbsolutePath {
return resolve(new URL(uri).pathname) as AbsolutePath;
return new URL(uri).pathname as AbsolutePath;

Check warning on line 47 in lib/uri.ts

View check run for this annotation

Codecov / codecov/patch

lib/uri.ts#L47

Added line #L47 was not covered by tests
},
ensure<S extends string>(...schemes: S[]): (uri: string) => URI<S> {
return (uri) => {
Expand Down

0 comments on commit bfcf519

Please sign in to comment.