velxio/frontend/src/__tests__
davidmonterocrespo24 8db973675a feat(sim): Phase 1c F1 — NgSpiceNodeAdapter runs real WASM in Node tests
Loads the vendored ngspice-interactive WASM directly in the Vitest
Node process, no Web Worker required.  Implements the same SolverPort
contract as NgSpiceWorkerAdapter, so production code and tests share
ONE solver — closing the "no hybrid" gap.

loadNgSpiceForNode (Node-only loader):
- Reads ngspice-lib.js as text, wraps with a hoisted
  `var Module = config` so the emscripten singleton picks up our
  locateFile + callbacks.
- Re-wires Module.onRuntimeInitialized to copy closure-local FS /
  HEAP* into Module._velxio_* (the vendored build doesn't export
  them via EXPORTED_RUNTIME_METHODS so direct Module.FS triggers an
  abort accessor).

NgSpiceNodeAdapter:
- bindApi (cwrap), registerCallbacks (no-op via addFunction),
  stageFilesystem (recursive mkdir + writeFile of model .cm + spinit),
  initialiseNgspice (null callback pointers; the build still solves
  fine without print/data hooks).
- loadCircuit writes the netlist to /circuit.spc on the FS and
  issues `source /circuit.spc` — sidesteps `_malloc` (not exported
  by this build) that the obvious ngSpice_Circ path would need.
- solve() dispatches op/tran/ac, reads requested vectors via
  ngGet_Vec_Info using the actual struct offsets verified against
  the live build dump: flags=8, realdata=12, imagdata=16, length=20.
- alterSource issues `alter` for incremental re-solves.

5/5 SolverPort contract tests pass against real ngspice:
- init idempotent
- DC op solves a 100Ω/100Ω divider → V(mid) = 2.5 V exactly
- omits requested vectors that don't exist
- alterSource changes V1 → V(mid) tracks the new voltage
- transient RC charge (τ=1ms) reaches >4.5V after 5τ

Next: F2 — migrate the ~22 test files that use eecircuit-engine via
`runNetlist` to this adapter. After F2, F3 deletes eecircuit-engine
and `SpiceEngine.ts` for good.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 20:49:39 +02:00
..
fixtures Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
helpers feat(multi-board): add wire-aware cross-board interconnect router 2026-04-25 19:47:40 -03:00
AVRSimulator.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
PinManager.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
RP2040Simulator.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
ammeter-waveform.test.ts Add end-to-end tests for ammeter, voltmeter, and capacitor charging behavior 2026-04-21 02:17:30 -03:00
arduino-arduino-spi.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
arduino-esp32-uart.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
arduino-pico-digital.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
arduino-pico-i2c.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
arduino-pico-mixed-uart.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
attiny85-simulation.test.ts test: increase timeout for blink sketch compilation test 2026-04-21 17:23:36 -03:00
capacitor-charge-transient.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
circuit-simulation-service.test.ts feat(sim): Phase 1c D1+D2 — MCU edges drive scheduler.alterSource + republish 2026-05-15 20:26:09 +02:00
circuit-verifier.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
component-metadata-bmp280.test.ts test(metadata): drill into components array for BMP280 lookup 2026-05-09 23:52:36 +02:00
component-to-spice.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
connect-legacy-solver-to-mixed-mode.test.ts feat(sim): Phase 1b continued, step 4 — bridge legacy solver into MixedModeScheduler 2026-05-15 17:15:24 +02:00
connect-mixed-mode-scheduler-to-store.test.ts feat(sim): Phase 1c step 1 — feature-flagged WASM-driven connector 2026-05-15 18:53:36 +02:00
dual-arduino-digital.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-arduino-hw-uart.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-arduino-multi-protocol.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-arduino-software-serial.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-esp32-uart.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-pico-digital.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-pico-multi-protocol.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
dual-pico-serial-passthrough.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
epaper-part-integration.test.ts feat: add support for UC8159c (ACeP 7-colour) display 2026-04-30 00:27:40 -03:00
esp32-dht22-flow.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
esp32-integration.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
esp32-rectifier-integration.test.ts Add end-to-end tests for ammeter, voltmeter, and capacitor charging behavior 2026-04-21 02:17:30 -03:00
esp32-servo-pot.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
esp32-wifi-bluetooth.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
esp32-wifi-compile.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
esp32-wifi-webserver-integration.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
esp32c3-blink.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
esp32c3-simulation.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
esp32c3-wifi-bluetooth.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
examples-analog-live.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
examples-analog.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
examples-circuits.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
examples-digital.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
examples-pico-doom.test.ts fix(examples/pico-doom): wire ILI9341 power + MISO 2026-05-14 23:22:31 -03:00
firmware-loader.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
flip-flop-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
i2c-complex-scenarios.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
i2c-esp32-multiboard-bridge.test.ts feat(i2c): cross-board bridging across all velxio boards (AVR/RP2040/ESP32 xtensa+riscv) 2026-05-12 17:51:39 -03:00
i2c-esp32-real-firmware.test.ts feat(i2c): cross-board bridging across all velxio boards (AVR/RP2040/ESP32 xtensa+riscv) 2026-05-12 17:51:39 -03:00
i2c-interconnect-bridge.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
i2c-lcd-coupling-gap.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
i2c-multi-board-slave-gap.test.ts feat(i2c): cross-board bridging across all velxio boards (AVR/RP2040/ESP32 xtensa+riscv) 2026-05-12 17:51:39 -03:00
i2c-real-firmware.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
install-libraries.test.ts fix(tests): restore Frontend Tests CI — patch stale RP2040 mocks + install-libraries 2026-05-02 22:46:32 -03:00
instruments.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
integration.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
interactive-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
interconnect-routing.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
issue-122-micropython-esp32.test.ts Add comprehensive tests for Cyw43Emulator functionality and lifecycle 2026-04-29 00:21:26 -03:00
load-example-transitions.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
load-ngspice-for-node.test.ts feat(sim): Phase 1c F1 — NgSpiceNodeAdapter runs real WASM in Node tests 2026-05-15 20:49:39 +02:00
logic-families.test.ts feat(sim): Phase 3 — logic families (TTL/CMOS-5V/LVCMOS33/AVR_HC/Schmitt) 2026-05-15 16:42:11 +02:00
logic-gate-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
mega-emulation.test.ts Add HD44780Decoder and various I2C sketches 2026-05-12 14:26:33 -03:00
mixed-mode-bjt-switch-integration.test.ts feat(sim): include component pins in NetlistBuilder.pinNetMap + e2e BJT-switch test 2026-05-15 17:22:36 +02:00
mixed-mode-scheduler.test.ts feat(sim): Phase 1c A4+A5 — scheduler depends on SolverPort 2026-05-15 19:24:12 +02:00
motor-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
multi-board-integration.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
netlist-builder.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
ngspice-interactive.test.ts feat(sim/spice): vendor ngspice+XSpice WASM and add NgSpiceInteractive client (Phase 1a) 2026-05-15 16:14:50 +02:00
ngspice-node-adapter.test.ts feat(sim): Phase 1c F1 — NgSpiceNodeAdapter runs real WASM in Node tests 2026-05-15 20:49:39 +02:00
phase-2-device-models.test.ts feat(sim): Phase 2.1 — migrate MOSFETs to VDMOS macro-models 2026-05-15 17:03:49 +02:00
phase-2-lm358-subckt.test.ts feat(sim): Phase 2.2 — vendor LM358 macro-model subckt (asset only) 2026-05-15 17:28:46 +02:00
phase-4-wire-resistance.test.ts feat(sim): Phase 4 — opt-in wire resistance (length_cm) 2026-05-15 18:31:28 +02:00
pi3-pico-uart.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
picow-cyw43-integration.test.ts feat(epaper): Add SVG layouts and emulation plan for ePaper panels 2026-04-29 02:33:59 -03:00
pin-position-rotation.test.ts fix(canvas): wires follow components on rotation 2026-05-12 18:03:32 -03:00
pin-resolver-phase1b.test.ts feat(sim): Phase 1b skeleton — SPICE-resolved PinResolver + active-path detection 2026-05-15 16:38:30 +02:00
pin-resolver.test.ts feat(sim): introduce PinResolver abstraction (Phase 0 of mixed-mode rewrite) 2026-05-15 15:50:09 +02:00
protocol-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
rp2040-pio-servo.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
sensor-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
serial-batching.test.ts
simulation-parts.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
simulation.test.ts
solver-port-contract.test.ts feat(sim): Phase 1c A2+A3 — NgSpiceWorkerAdapter + FakeSolverAdapter 2026-05-15 19:21:46 +02:00
spice-ac.test.ts
spice-active.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-avr-mixed.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-digital.test.ts
spice-mosfet-diag.test.ts style: update ESLint rules and clean up code formatting across multiple files 2026-04-21 17:14:27 -03:00
spice-mosfet-pwm.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-npn-switch-diag.test.ts style: update ESLint rules and clean up code formatting across multiple files 2026-04-21 17:14:27 -03:00
spice-npn-switch-integration.test.ts style: update ESLint rules and clean up code formatting across multiple files 2026-04-21 17:14:27 -03:00
spice-passive.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-rectifier-integration.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-rectifier-live-bootstrap.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-rectifier-live-repro.test.ts feat(sim): Phase 1c C1+C2 — extract ADC/waveform bridge to solver-agnostic module 2026-05-15 20:20:49 +02:00
spice-relaxation-oscillator.test.ts
spice-relay-integration.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-signal-generator-tran.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-smoke.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
spice-transient.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
ssd168x-decoder.test.ts feat: add support for UC8159c (ACeP 7-colour) display 2026-04-30 00:27:40 -03:00
ssd1306-render.test.ts refactor: rename components and update prefixes to 'velxio-' for consistency 2026-04-21 16:45:45 -03:00
triple-pico-digital-chain.test.ts Add end-to-end tests for ESP32 I2C functionality and circuit verification 2026-05-12 16:55:15 -03:00
uc8159c-decoder.test.ts feat: add support for UC8159c (ACeP 7-colour) display 2026-04-30 00:27:40 -03:00
undo-redo.test.ts feat(canvas): undo/redo command pattern + history slice 2026-05-08 12:03:17 -03:00
virtual-i2c-devices.test.ts refactor: rename wokwi-libs/ → third-party/ 2026-05-03 00:58:57 -03:00
voltmeter-waveform.test.ts Add end-to-end tests for ammeter, voltmeter, and capacitor charging behavior 2026-04-21 02:17:30 -03:00
waveform-stats.test.ts Add end-to-end tests for ammeter, voltmeter, and capacitor charging behavior 2026-04-21 02:17:30 -03:00