Package com.vaadin.flow.testutil
Class FrontendStubs
- java.lang.Object
-
- com.vaadin.flow.testutil.FrontendStubs
-
public class FrontendStubs extends Object
Utility class for stubbing Node.JS and Webpack scripts.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFrontendStubs.ToolTypes of build tools.static classFrontendStubs.ToolStubBuilderBuilds a new instance ofFrontendStubs.ToolStubInfo.static classFrontendStubs.ToolStubInfoHolds an information about build tool to be stubbed.
-
Field Summary
Fields Modifier and Type Field Description static StringVITE_SERVERstatic StringVITE_TEST_OUT_FILEstatic StringWEBPACK_SERVERstatic StringWEBPACK_TEST_OUT_FILE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateStubNode(boolean stubNode, boolean stubNpm, String baseDir)Creates stub versions of `node` and `npm` in the ./node folder as frontend-maven-plugin does.static voidcreateStubNode(FrontendStubs.ToolStubInfo stubNode, FrontendStubs.ToolStubInfo stubNpm, String baseDir)Creates stub versions of `node` and `npm` in the ./node folder as frontend-maven-plugin does.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.static voidcreateStubWebpackServer(String readyString, int milliSecondsToRun, String baseDir)Creates a stub webpack-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 voidcreateStubWebpackServer(String readyString, int milliSecondsToRun, String baseDir, boolean enableListening)Creates a stub webpack-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 Detail
-
WEBPACK_SERVER
public static final String WEBPACK_SERVER
- See Also:
- Constant Field Values
-
WEBPACK_TEST_OUT_FILE
public static final String WEBPACK_TEST_OUT_FILE
- See Also:
- Constant Field Values
-
VITE_SERVER
public static final String VITE_SERVER
- See Also:
- Constant Field Values
-
VITE_TEST_OUT_FILE
public static final String VITE_TEST_OUT_FILE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 IOExceptionCreates 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
-
createStubWebpackServer
public static void createStubWebpackServer(String readyString, int milliSecondsToRun, String baseDir, boolean enableListening) throws IOException
Creates a stub webpack-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
-
createStubWebpackServer
public static void createStubWebpackServer(String readyString, int milliSecondsToRun, String baseDir) throws IOException
Creates a stub webpack-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
-
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
-
-