Skip to content

Commit

Permalink
test log
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 7, 2024
1 parent 75c7e7b commit 67267ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
test:
strategy:
matrix:
version: [20, 21]
os: [ubuntu-latest, windows-latest]
version: [20]
os: [windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -21,12 +21,7 @@ jobs:
node-version: ${{ matrix.version }}
cache: yarn
- run: yarn --frozen-lockfile
- run: yarn test:coverage
- run: yarn test:tsc
- run: |
echo ::add-matcher::.github/eslint.json
yarn run eslint src test --format=compact --max-warnings=0
- run: yarn test:prettier
- run: yarn test:mocha:serial
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
9 changes: 9 additions & 0 deletions src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ export function parseRelativeUrl(url: string): {pathname: string; search: string
}

export function within(root: string, path: string): boolean {
console.log("within", {
"fromOsPath(root)": fromOsPath(root),
"resolve(fromOsPath(root))": resolve(fromOsPath(root)),
"normalize(resolve(fromOsPath(root)))": normalize(resolve(fromOsPath(root))),
"fromOsPath(path)": fromOsPath(path),
"resolve(fromOsPath(path))": resolve(fromOsPath(path)),
"normalize(resolve(fromOsPath(path)))": normalize(resolve(fromOsPath(path))),
"relative(normalize(resolve(fromOsPath(root))), normalize(resolve(fromOsPath(path))))": relative(normalize(resolve(fromOsPath(root))), normalize(resolve(fromOsPath(path))))
});
path = relative(normalize(resolve(fromOsPath(root))), normalize(resolve(fromOsPath(path))));
return !path.startsWith("..") && !isAbsolute(path);
}
2 changes: 1 addition & 1 deletion test/path-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe("parseRelativeUrl(url)", () => {
});
});

describe("within(root, path)", () => {
describe.only("within(root, path)", () => {
it("returns true for paths within the current working directory", () => {
assert.strictEqual(within(process.cwd(), "dist"), true, "dist");
assert.strictEqual(within(process.cwd(), "./dist"), true, "./dist");
Expand Down

0 comments on commit 67267ee

Please sign in to comment.