Skip to content

Commit

Permalink
ci: test
Browse files Browse the repository at this point in the history
  • Loading branch information
lhz960904 committed Dec 16, 2023
1 parent 66ccc4f commit e2e5812
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/shared.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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[]) {
Expand Down
10 changes: 5 additions & 5 deletions test/shared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

Expand Down

0 comments on commit e2e5812

Please sign in to comment.