Skip to content

Commit

Permalink
Switch from npx to pnpm dlx
Browse files Browse the repository at this point in the history
  • Loading branch information
johanndev committed Jan 8, 2024
1 parent 800ea11 commit c3da5c1
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions library/tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@ import { describe, expect, test } from 'vitest';
import { spawnSync } from 'node:child_process';
import { join } from 'node:path';
describe('Integration', () => {
test.each([
['4.9.5', false],
['5.0.2', true],
])(
'with TypeScript version %s should work: %s',
async (tsVersion, expectSuccess) => {
const npx = spawnSync('npx', [
'--yes',
'--package',
`typescript@${tsVersion}`,
'tsc',
'--noEmit',
'--target',
'ES6',
join(__dirname, 'testscript.ts'),
]);
test.each([
['4.9.5', false],
['5.0.2', true],
])(
'with TypeScript version %s should work: %s',
(tsVersion, expectSuccess) => {
const npx = spawnSync('pnpm', [
'--package',
`typescript@${tsVersion}`,
'--silent',
'dlx',
'tsc',
'--noEmit',
'--target',
'ES6',
join(__dirname, 'testscript.ts'),
]);

const npxOutput = npx.output.toString();
const containsError = npxOutput.includes('error TS');
if (expectSuccess) {
expect(containsError).toBeFalsy();
} else {
expect(containsError).toBeTruthy();
}
}
);
const npxOutput = npx.output.toString();
const containsError = npxOutput.includes('error TS');
if (expectSuccess) {
expect(containsError).toBeFalsy();
} else {
expect(containsError).toBeTruthy();
}
}
);
});

0 comments on commit c3da5c1

Please sign in to comment.