diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c17efc6..7203089 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: strategy: matrix: node: [lts/*] - os: [ubuntu-latest, windows-latest, macos-latest] + os: [windows-latest, macos-latest] fail-fast: false steps: diff --git a/src/shared.ts b/src/shared.ts index 4f04a72..3e1795a 100644 --- a/src/shared.ts +++ b/src/shared.ts @@ -1,4 +1,4 @@ -import { join } from 'node:path' +import path, { join } from 'node:path' import process from 'node:process' import fs from 'node:fs' import fsp from 'node:fs/promises' @@ -54,7 +54,7 @@ export async function resolveTargetPath(repository: string) { const targetPath = join(config.baseDir, ...suffixPaths) - return targetPath + return path.normalize(targetPath) } export function normalizeCliWidth(strArr: string[]) { diff --git a/test/shared.test.ts b/test/shared.test.ts index cbc78cc..e1fccf1 100644 --- a/test/shared.test.ts +++ b/test/shared.test.ts @@ -27,26 +27,26 @@ describe('shared', () => { const cases = [ { config: { baseDir: '/test', groupBy: { source: true, owner: true } }, - expected: '/test/github.com/lhz960904/repom', + expected: path.normalize('/test/github.com/lhz960904/repom'), }, { config: { baseDir: '/test', groupBy: { source: true, owner: true } }, - expected: '/test/github.com/lhz960904/repom', + expected: path.normalize('/test/github.com/lhz960904/repom'), }, { config: { baseDir: '/test', groupBy: { source: false, owner: true } }, - expected: '/test/lhz960904/repom', + expected: path.normalize('/test/lhz960904/repom'), }, { config: { baseDir: '/test', groupBy: { source: false, owner: false } }, - expected: '/test/repom', + expected: path.normalize('/test/repom'), }, ] cases.forEach(async ({ config, expected }) => { vi.mocked(fs.existsSync).mockReturnValueOnce(true) vi.mocked(fsp.readFile).mockResolvedValueOnce(JSON.stringify(config)) const path = await resolveTargetPath(repository) - expect(path.normalize(path)).toEqual(path.normalize(expected)) + expect(path).toEqual(expected) }) })