Skip to content

Commit

Permalink
fix: packager detect tests are not running (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyupe authored Jan 31, 2024
1 parent 1ad74b0 commit 9fb5b2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/programmatic/__snapshots__/detect.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ exports[`packager > npm 1`] = `"npm"`;

exports[`packager > pnpm 1`] = `"pnpm"`;

exports[`packager > pnpm@6 1`] = `"pnpm"`;
exports[`packager > pnpm@6 1`] = `"pnpm@6"`;

exports[`packager > unknown 1`] = `null`;

exports[`packager > yarn 1`] = `"yarn"`;

exports[`packager > yarn@berry 1`] = `"yarn"`;
exports[`packager > yarn@berry 1`] = `"yarn@berry"`;
8 changes: 4 additions & 4 deletions test/programmatic/detect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { AGENTS, detect } from '../../src'

let basicLog: SpyInstance, errorLog: SpyInstance, warnLog: SpyInstance, infoLog: SpyInstance

function detectTest(agent: string) {
function detectTest(fixture: string, agent: string) {
return async () => {
const cwd = await fs.mkdtemp(path.join(tmpdir(), 'ni-'))
const fixture = path.join(__dirname, '..', 'fixtures', 'lockfile', agent)
await fs.copy(fixture, cwd)
const dir = path.join(__dirname, '..', 'fixtures', fixture, agent)
await fs.copy(dir, cwd)

expect(await detect({ programmatic: true, cwd })).toMatchSnapshot()
}
Expand All @@ -33,7 +33,7 @@ const fixtures = ['lockfile', 'packager']

// matrix testing of: fixtures x agents
fixtures.forEach(fixture => describe(fixture, () => agents.forEach((agent) => {
it(agent, detectTest(agent))
it(agent, detectTest(fixture, agent))

it('no logs', () => {
expect(basicLog).not.toHaveBeenCalled()
Expand Down

0 comments on commit 9fb5b2d

Please sign in to comment.