UNPKG

node-osc

Version:

pyOSC inspired library for sending and receiving OSC messages

43 lines (36 loc) 1.71 kB
'use strict'; var tap = require('tap'); var node_child_process = require('node:child_process'); var node_path = require('node:path'); var node_url = require('node:url'); var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; const __dirname$1 = node_url.fileURLToPath(new URL('.', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('test-types.js', document.baseURI).href)))); // Only run in ESM mode (not when transpiled to CJS in dist/) // Normalize path separators for cross-platform compatibility const normalizedPath = __dirname$1.replace(/\\/g, '/'); const isESM = !normalizedPath.includes('/dist/'); tap.test('types: TypeScript compilation', (t) => { let tsconfigPath; const testRoot = node_path.resolve(__dirname$1, isESM ? '.': '../../test'); if (isESM) { tsconfigPath = node_path.join(testRoot, 'fixtures', 'types', 'tsconfig-esm.test.json'); } else { tsconfigPath = node_path.join(testRoot, 'fixtures', 'types', 'tsconfig-cjs.test.json'); } try { // Run TypeScript compiler const cmd = 'npx tsc --project "' + tsconfigPath + '"'; node_child_process.execSync(cmd, { encoding: 'utf-8', stdio: 'pipe', cwd: node_path.join(testRoot, 'fixtures', 'types') }); t.pass('TypeScript types compile successfully'); } catch (error) { t.fail('TypeScript compilation failed: ' + error.message); if (error.stdout) console.log('STDOUT:', error.stdout); if (error.stderr) console.log('STDERR:', error.stderr); } t.end(); });