diff --git a/library/tests/integration.test.ts b/library/tests/integration.test.ts new file mode 100644 index 000000000..5ee930e09 --- /dev/null +++ b/library/tests/integration.test.ts @@ -0,0 +1,32 @@ +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', + (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(); + } + } + ); +}); diff --git a/library/tests/testscript.ts b/library/tests/testscript.ts new file mode 100644 index 000000000..03c4def95 --- /dev/null +++ b/library/tests/testscript.ts @@ -0,0 +1 @@ +import * as v from '../dist/index.js'; \ No newline at end of file