njsparser/js/tests/setup.js
2026-02-15 01:34:37 +01:00

21 lines
613 B
JavaScript

/**
* Test setup and utilities
*/
// deno-dom's repo layout doesn't expose a Node-style package entry by default.
// For Bun tests we import the WASM build directly.
import { DOMParser } from 'deno-dom/deno-dom-wasm.ts';
import { readFileSync } from 'fs';
import { join } from 'path';
// Export DOMParser for tests
export { DOMParser };
/**
* Load test HTML file
* @param {string} filename - Name of the HTML file in test/src/
* @returns {string} HTML content
*/
export function loadTestHTML(filename) {
const path = join(process.cwd(), 'test', 'src', filename);
return readFileSync(path, 'utf-8');
}