Package com.vaadin.flow.testutil
Class FrontendStubs
java.lang.Object
com.vaadin.flow.testutil.FrontendStubs
Utility class for stubbing Node.JS and frontend tooling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of build tools.static classBuilds a new instance ofFrontendStubs.ToolStubInfo.static final classHolds an information about build tool to be stubbed. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreateStubNode(boolean stubNode, boolean stubNpm, String baseDir) Creates stub versions of `node` and `npm` in the .static voidcreateStubNode(FrontendStubs.ToolStubInfo stubNode, FrontendStubs.ToolStubInfo stubNpm, String baseDir) Creates stub versions of `node` and `npm` in the .static voidcreateStubViteServer(String readyString, int milliSecondsToRun, String baseDir) Creates a stub vite-dev-server able to output a ready string, sleep for a while and output arguments passed to a file, so as tests can check it.static voidcreateStubViteServer(String readyString, int milliSecondsToRun, String baseDir, boolean enableListening) Creates a stub vite-dev-server able to output a ready string, sleep for a while and output arguments passed to a file, so as tests can check it.
-
Field Details
-
VITE_SERVER
- See Also:
-
VITE_PACKAGE_JSON
- See Also:
-
VITE_TEST_OUT_FILE
- See Also:
-
-
Method Details
-
createStubNode
public static void createStubNode(FrontendStubs.ToolStubInfo stubNode, FrontendStubs.ToolStubInfo stubNpm, String baseDir) throws IOException Creates stub versions of `node` and `npm` in the ./node folder as frontend-maven-plugin does.- Parameters:
stubNode- node stub information, including whether `node/node` (`node/node.exe`) stub should be created, and what version should it output if '-v' || '--version' flag are set.stubNpm- npm stub information, including whether `node/node_modules/npm/bin/npm-cli` and `npx-cli` should be created, and what version should it output if '-v' || '--version' flag are set.baseDir- parent to create `node` dir in- Throws:
IOException- when a file operation fails
-
createStubNode
public static void createStubNode(boolean stubNode, boolean stubNpm, String baseDir) throws IOException Creates stub versions of `node` and `npm` in the ./node folder as frontend-maven-plugin does. This method creates a default stubs for tool's versions.- Parameters:
stubNode- whether `node/node` (`node/node.exe`) stub should be createdstubNpm- whether `node/node_modules/npm/bin/npm-cli` and `npx-cli` should be createdbaseDir- parent to create `node` dir in- Throws:
IOException- when a file operation fails
-
createStubViteServer
public static void createStubViteServer(String readyString, int milliSecondsToRun, String baseDir, boolean enableListening) throws IOException Creates a stub vite-dev-server able to output a ready string, sleep for a while and output arguments passed to a file, so as tests can check it.- Parameters:
readyString- string to outputmilliSecondsToRun- time to keep the server runningbaseDir- parent directoryenableListening- enable listening to port passed via `--port`- Throws:
IOException- when a file operation fails
-
createStubViteServer
public static void createStubViteServer(String readyString, int milliSecondsToRun, String baseDir) throws IOException Creates a stub vite-dev-server able to output a ready string, sleep for a while and output arguments passed to a file, so as tests can check it.- Parameters:
readyString- string to outputmilliSecondsToRun- time to keep the server runningbaseDir- parent directory- Throws:
IOException- when a file operation fails
-