Skip to content

Commit

Permalink
chore: update tests for conversions
Browse files Browse the repository at this point in the history
added to new tests and updated the existing tests for `npx` conversions.
  • Loading branch information
Jay-Karia committed Aug 17, 2024
1 parent 75cc5c5 commit e0fdc9f
Showing 1 changed file with 172 additions and 33 deletions.
205 changes: 172 additions & 33 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,67 +428,70 @@ describe('Yarn to NPM tests', () => {
})
})

describe('NPX tests', () => {
const tests: [npm: string, yarn: string, pnpm: string, bun: string][] = [
describe('to yarn dlx tests', () => {
const tests: [npm: string, yarn: string][] = [
// npx -> ...
[
'npx create-next-app',
'yarn dlx create-next-app',
'pnpm dlx create-next-app',
'bun x create-next-app',
],
[
'npx prettier --help',
'yarn dlx prettier --help',
'pnpm dlx prettier --help',
'bun x prettier --help',
],
[
'npx prettier -w .',
'yarn dlx prettier -w .',
'pnpm dlx prettier -w .',
'bun x prettier -w .',
],
[
'npx @neutrinojs/create-project my-app',
'yarn dlx @neutrinojs/create-project my-app',
'pnpm dlx @neutrinojs/create-project my-app',
'bun x @neutrinojs/create-project my-app',
],
[
'npx create-react-app my-app --template typescript',
'yarn dlx create-react-app my-app --template typescript',
],
// pnpm dlx -> ...
[
'pnpm dlx create-next-app',
'yarn dlx create-next-app',
],
[
'pnpm dlx prettier --help',
'yarn dlx prettier --help',
],
[
'pnpm dlx prettier -w .',
'yarn dlx prettier -w .',
],
[
'pnpm dlx @neutrinojs/create-project my-app',
'yarn dlx @neutrinojs/create-project my-app',
],
[
'pnpm dlx create-react-app my-app --template typescript',
'bun x create-react-app my-app --template typescript',
'yarn dlx create-react-app my-app --template typescript',
],
// bun x -> ...
[
'npx vue-cli-service --help',
'yarn dlx vue-cli-service --help',
'pnpm dlx vue-cli-service --help',
'bun x vue-cli-service --help',
'bun x create-next-app',
'yarn dlx create-next-app',
],
[
'npx vue-cli-service serve',
'yarn dlx vue-cli-service serve',
'pnpm dlx vue-cli-service serve',
'bun x vue-cli-service serve',
'bun x prettier --help',
'yarn dlx prettier --help',
],
[
'npx json-server ./test.json',
'yarn dlx json-server ./test.json',
'pnpm dlx json-server ./test.json',
'bun x json-server ./test.json',
'bun x prettier -w .',
'yarn dlx prettier -w .',
],
[
'npx envinfo --preset react',
'yarn dlx envinfo --preset react',
'pnpm dlx envinfo --preset react',
'bun x envinfo --preset react',
'bun x @neutrinojs/create-project my-app',
'yarn dlx @neutrinojs/create-project my-app',
],
[
'npx npm-upgrade',
'yarn dlx npm-upgrade',
'pnpm dlx npm-upgrade',
'bun x npm-upgrade',
'bun x create-react-app my-app --template typescript',
'yarn dlx create-react-app my-app --template typescript',
],
]

Expand All @@ -497,15 +500,151 @@ describe('NPX tests', () => {
expect(convert(npmValue, 'yarn')).toEqual(yarnValue)
})
})
})

describe('to pnpm dlx tests', () => {
const tests: [npm: string, pnpm: string][] = [
// npx -> ...
[
'npx create-next-app',
'pnpm dlx create-next-app',
],
[
'npx prettier --help',
'pnpm dlx prettier --help',
],
[
'npx prettier -w .',
'pnpm dlx prettier -w .',
],
[
'npx @neutrinojs/create-project my-app',
'pnpm dlx @neutrinojs/create-project my-app',
],
[
'npx create-react-app my-app --template typescript',
'pnpm dlx create-react-app my-app --template typescript',
],
// yarn dlx -> ...
[
'yarn dlx create-next-app',
'pnpm dlx create-next-app',
],
[
'yarn dlx prettier --help',
'pnpm dlx prettier --help',
],
[
'yarn dlx prettier -w .',
'pnpm dlx prettier -w .',
],
[
'yarn dlx @neutrinojs/create-project my-app',
'pnpm dlx @neutrinojs/create-project my-app',
],
[
'yarn dlx create-react-app my-app --template typescript',
'pnpm dlx create-react-app my-app --template typescript',
],
// bun x -> ...
[
'bun x create-next-app',
'pnpm dlx create-next-app',
],
[
'bun x prettier --help',
'pnpm dlx prettier --help',
],
[
'bun x prettier -w .',
'pnpm dlx prettier -w .',
],
[
'bun x @neutrinojs/create-project my-app',
'pnpm dlx @neutrinojs/create-project my-app',
],
[
'bun x create-react-app my-app --template typescript',
'pnpm dlx create-react-app my-app --template typescript',
],
]

describe('to PNPM', () => {
it.each(tests)('%s', (npmValue, _yarnValue, pnpmValue) => {
it.each(tests)('%s', (npmValue, pnpmValue) => {
expect(convert(npmValue, 'pnpm')).toEqual(pnpmValue)
})
})
})

describe('to bun x tests', () => {
const tests: [npm: string, bun: string][] = [
// npx -> ...
[
'npx create-next-app',
'bun x create-next-app',
],
[
'npx prettier --help',
'bun x prettier --help',
],
[
'npx prettier -w .',
'bun x prettier -w .',
],
[
'npx @neutrinojs/create-project my-app',
'bun x @neutrinojs/create-project my-app',
],
[
'npx create-react-app my-app --template typescript',
'bun x create-react-app my-app --template typescript',
],
// yarn dlx -> ...
[
'yarn dlx create-next-app',
'bun x create-next-app',
],
[
'yarn dlx prettier --help',
'bun x prettier --help',
],
[
'yarn dlx prettier -w .',
'bun x prettier -w .',
],
[
'yarn dlx @neutrinojs/create-project my-app',
'bun x @neutrinojs/create-project my-app',
],
[
'yarn dlx create-react-app my-app --template typescript',
'bun x create-react-app my-app --template typescript',
],
// pnpm dlx -> ...
[
'pnpm dlx create-next-app',
'bun x create-next-app',
],
[
'pnpm dlx prettier --help',
'bun x prettier --help',
],
[
'pnpm dlx prettier -w .',
'bun x prettier -w .',
],
[
'pnpm dlx @neutrinojs/create-project my-app',
'bun x @neutrinojs/create-project my-app',
],
[
'pnpm dlx create-react-app my-app --template typescript',
'bun x create-react-app my-app --template typescript',
],
]

describe('to Bun', () => {
it.each(tests)('%s', (npmValue, _yarnValue, _pnpmValue, bunValue) => {
it.each(tests)('%s', (npmValue, bunValue) => {
expect(convert(npmValue, 'bun')).toEqual(bunValue)
})
})
Expand Down

0 comments on commit e0fdc9f

Please sign in to comment.