[JS] Add importModel(tensor) overload, getAvailableFrontEnds binding and tests
Summary
This PR introduces enhancements to the OpenVINO JavaScript bindings, adding new API functionality and improving test coverage and robustness.
Changes
- Added
Core.getAvailableFrontEnds()binding to the JS API. - Added async
Core.importModel()overload that accepts anov.Tensoras input. - The Promise returned by
importModel()now correctly rejects on C++ exceptions. - Added corresponding TypeScript typings for the new overload.
- Added unit tests validating both the
getAvailableFrontEnds()binding and the newimportModel(tensor)functionality. - Minor test robustness improvement: compiled_model tests are skipped automatically when the
BATCHdevice is unavailable locally.
Validation
Local test results:
224 passed, 0 failed, 10 skipped
Notes
Closes #32725
Hi @almilosz, @Retribution98
This PR adds a few JavaScript-side enhancements and corresponding tests as discussed:
- Added
Core.getAvailableFrontEnds()binding to expose available frontends in JS. - Introduced an async
Core.importModel()overload that accepts anov.Tensor.- The Promise now properly rejects when a C++ exception occurs.
- Updated TypeScript typings to include the new overload.
- Added unit tests covering both
getAvailableFrontEnds()andimportModel(tensor). - Improved test robustness:
compiled_modeltests are skipped automatically when theBATCHdevice isn’t available locally.
Local test results 224 passed, 0 failed, 10 skipped
Everything builds and runs cleanly on the current v3.8_for_ie_master baseline.
Please review when you have a moment — feedback on API design and test coverage is welcome.
Thanks for reviewing. I’ve pushed the updates:
- Fixed the unsafe
ThreadSafeFunctionerror-message capture incore_wrap.cpp(captured by value to avoid lifetime issues). - Added guards in the
compiled_modeltests so they skip cleanly when the BATCH device isn’t available orcompiledModelreturnsnull. - Made the external-tensor interoperability tests optional by skipping when
__getExternalTensorisn’t exposed by the native addon. - Cleaned up a stray blank line in
basic.test.js. - Applied
clang-format-18to the modified C++ section.
Local test results:
✔️ 236 run
✔️ 224 passed
⚠️ 12 skipped
❌ 0 failed
Please re-run CI so formatting checks and platform builds can validate on the official runners.
Hey @mlukasze, now can you just this commit, and let me know that everything is fine. If so, you can merge this. Appreciate your review and response.
Yeah sure I will update them as soon as possible!! Thank you for review
Thanks for the review @almilosz — I’ve applied the requested changes and pushed them to [js/import-model-tensor]. Summary of fixes:
- Removed: getAvailableFrontEnds binding and its implementation (not part of [ov::Core] — [core_wrap.cpp]
- Fixed: duplicate [getAvailableDevices] registration and tidied [importModel] comments/overload notes — [core_wrap.cpp]
- Formatting / lint: collapsed overload signatures and fixed JSDoc in [addon.ts] (Prettier), removed unused catch params in [compiled_model.test.js] (ESLint).
- Removed tests: dropped out-of-scope native __getExternalTensor interoperability tests from [tensor.test.js] per your suggestion (depend on private native API).
- C++ style: ran clang-format on changed headers/sources and committed the results ([core_wrap.hpp]
CI status: I pushed changes and CI ran — current workflow runs show action_required (some jobs require attention). The lint/format issues reported earlier were addressed; if any CI jobs still fail I can fetch and post the failing job logs.
Please re-review when you have a moment. I’ll promptly apply any follow-ups you request.
Hey @almilosz, could you please approve the workflows? If any error logs come up afterward, I’ll review them.
Hey @mlukasze, thank you for the approval, I saw two checks were unsuccessful, and I hope I solved them, Kindly once again approve the workflow to run against checks, and if any errors raise, I am ready to tackle them.
build_jenkins
build_jenkins
some comments from review are not addressed still Code itself looks like stabilizing, but final clean up as instructed is necessary
Ok, thank you for the review, I will update PR as soon as possible
Hello @Yashwanth1124 , are you still working on this task?
Yes @almilosz , i have made few commits, waiting for approval since a week.
Yes @almilosz , i have made few commits, waiting for approval since a week.
Hi @Yashwanth1124 I see that not all of the comments have been fixed. Please check the pushed commits and review the comments one more time. Fix them or leave a reply if you have any objections.