Conversation
42f322d to
7cef103
Compare
7cef103 to
8467122
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This PR introduces an experimental Node.js runtime for executing JavaScript within
.httpfiles, offering enhanced capabilities like npm package support and modern JavaScript features. It also adds corresponding documentation and an example to showcase the new functionality.Motivation:
The current embedded Goja JavaScript engine lacks support for native npm packages and asynchronous helpers, limiting the flexibility and expressiveness of JavaScript code within
.httpscenarios. The experimental Node.js runtime addresses these limitations, allowing users to leverage a broader range of JavaScript features and libraries.What was changed:
.gitignore: Addednode_modulesandresultsdirectories within theexamplesfolder to the ignore list.README.md: Updated documentation to include information on the--experimental-node-runtimeflag, request helpers,await, and the experimental Node.js runtime.cmd/httprunner/main.go:--experimental-node-runtimeflag to enable the Node.js runtime.node_modulesdirectories and add them to Node's module resolution paths.NODE_PATHenvironment to Node runtime for custom module layouts.docs/specs/javascript-runtimes.md: Introduced a new document that outlines JavaScript execution for.httpscenarios.examples/external-node-runtime/: Added a new example folder demonstrating how to execute.httpscenarios with the experimental Node.js runtime and consume dependencies installed fromnpm.runner/runner.go:useNodeRuntimeandnodeRequirePathsfields to theRunnerstruct.template/node_runtime.go: Added a new file containing the implementation of the Node.js runtime, including process management, message handling, and script execution.template/node_worker.js: Added a new file containing the JavaScript code for the Node.js worker process, responsible for executing scripts and interacting with thehttprunnerprocess.template/template.go:RuntimeModeenum to select betweengojaandnoderuntime.Tests:
No new tests were written, and existing tests were not adapted to the new Node.js runtime. Warning: Comprehensive tests for the Node.js runtime are missing. Thorough testing is required to ensure the stability and reliability of the new feature.