Closed jerinphilip closed 2 years ago
OpenCV is a mature C++ library which exposes bindings to JavaScript and has JavaScript tests (https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html) which we could potentially draw references/examples from. They also appear to be using WebAssembly SIMD and threads.
They allow automated testing variations of:
There appears to be a headless mechanism to test JavaScript via Firefox of which an example can be found in https://github.com/mozilla/firefox-translations/pull/106.
An incremental approach could be doing (1) manually in the browser and deploying to some health status Github page. This will prepare the test primitives and then we can look at the tests running headless.
@jelmervdl has successfully managed to run the WASM module via node.js in https://gist.github.com/jelmervdl/a4c8b6b92ad88a885e1cbd51c6ad4902. This opens up possibilities for headless testing.
The current JavaScript "example" for the test page is perhaps not the best provision from here. There are a few common functions that can be abstracted here, potentially tested headless and seen by multiple eyes. Therefore, a better solution is a JavaScript library or module, ideally with an API consistent with the C++ from which it is derived.
The following are ideas of a few downstream applications of a JavaScript library that can do translation and is batteries included:
alignment:true
andresponseOptions.HTML
correct here, but transfer to firefox-translations led to inconsistent config).There are parts of this library already existing in sources across a few repositories. At the moment the extra work and duplication is convenient for faster development cycles. But at some point in the future, we should look at consolidating commonly used functionalities here co-located with the bindings and continuously tested. The JavaScript module can be part of the releases from this repository.
This issue is meant to investigate and discuss ideas, weigh the pros and cons of the approach.