jsx-types.test.ts
This file
Path
build/jsx-types.test.ts
20 lines 路 901 bytes 路 TypeScript
Last changed by
test(build): type-check the bundled declarations from a consumer project (#5486)Yusuke Wadabefore adoptionc437d75
History of this fileTake it
123456789101112131415161718192021import { spawnSync } from 'node:child_process'import { createRequire } from 'node:module'import { fileURLToPath } from 'node:url'import { describe, expect, it } from 'vitest'
const compiler = createRequire(import.meta.url).resolve('typescript/bin/tsc')const project = fileURLToPath(new URL('./fixtures/jsx-types/tsconfig.json', import.meta.url))
describe.each(['hono/jsx', 'hono/jsx/dom'])('published %s declarations', (jsxImportSource) => { it.each(['react-jsx', 'react-jsxdev'])('preserves JSX attribute checking with %s', (jsx) => { // Resolve the package exports to dist/types, as a consumer would after a build. const result = spawnSync( process.execPath, [compiler, '--project', project, '--jsxImportSource', jsxImportSource, '--jsx', jsx], { encoding: 'utf8' } ) expect(result.stdout + result.stderr).toBe('') expect(result.status).toBe(0) })})