-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.setup.ts
More file actions
25 lines (20 loc) · 904 Bytes
/
Copy pathvitest.setup.ts
File metadata and controls
25 lines (20 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-FileCopyrightText: 2026 Semiotic AI, Inc.
//
// SPDX-License-Identifier: BUSL-1.1
/**
* Vitest setup file for loading WASM module in Node.js test environment.
*
* The WASM module is built with --target web which uses fetch() for loading.
* In Node.js/Vitest, we use initSync() with the binary loaded from filesystem.
*/
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import { initSync } from './packages/agentium-native/wasm/pkg/agentium_sdk_wasm.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Load WASM binary from filesystem
const wasmPath = resolve(__dirname, 'packages/agentium-native/wasm/pkg/agentium_sdk_wasm_bg.wasm');
const wasmBinary = readFileSync(wasmPath);
// Initialize WASM synchronously before tests run
initSync({ module: wasmBinary });