Skip to content
Myr

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 file

Take it

test(build): type-check the bundled declarations from a consumer project (#5486)Yusuke Wadabefore adoptionc437d75

lines 1–20why, one step back
1import { spawnSync } from 'node:child_process'
2import { createRequire } from 'node:module'3import { fileURLToPath } from 'node:url'4import { describe, expect, it } from 'vitest'56const compiler = createRequire(import.meta.url).resolve('typescript/bin/tsc')7const project = fileURLToPath(new URL('./fixtures/jsx-types/tsconfig.json', import.meta.url))89describe.each(['hono/jsx', 'hono/jsx/dom'])('published %s declarations', (jsxImportSource) => {10 it.each(['react-jsx', 'react-jsxdev'])('preserves JSX attribute checking with %s', (jsx) => {11 // Resolve the package exports to dist/types, as a consumer would after a build.12 const result = spawnSync(13 process.execPath,14 [compiler, '--project', project, '--jsxImportSource', jsxImportSource, '--jsx', jsx],15 { encoding: 'utf8' }16 )17 expect(result.stdout + result.stderr).toBe('')18 expect(result.status).toBe(0)19 })20})