Files
2025-10-14 00:02:05 +07:00

28 lines
584 B
JavaScript

if ('Bun' in globalThis) {
throw new Error('❌ Use Node.js to run this test!')
}
setTimeout(() => {
console.log('❌ CJS Node.js timed out')
process.exit(1)
}, 5000)
const { Elysia, t } = require('elysia')
const app = new Elysia().get('/', () => 'Node.js', {
response: t.String()
})
const main = async () => {
const response = await app.handle(new Request('http://localhost'))
if ((await response.text()) !== 'Node.js') {
throw new Error('❌ CommonJS Node.js failed')
}
console.log('✅ CommonJS Node.js works!')
process.exit()
}
main()