From 67267eebca35e6352dde61ec6ba892da3558c484 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Wed, 6 Nov 2024 21:44:54 -0800 Subject: [PATCH] test log --- .github/workflows/test.yml | 11 +++-------- src/path.ts | 9 +++++++++ test/path-test.ts | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cde590bdf..331d75c1d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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: diff --git a/src/path.ts b/src/path.ts index 547141175..799e45dcd 100644 --- a/src/path.ts +++ b/src/path.ts @@ -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); } diff --git a/test/path-test.ts b/test/path-test.ts index 3e373c7fb..59e492348 100644 --- a/test/path-test.ts +++ b/test/path-test.ts @@ -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");