diff options
author | huaxing <huaxing.jin@est.tech> | 2020-03-11 09:50:37 +0800 |
---|---|---|
committer | huaxing <huaxing.jin@est.tech> | 2020-03-17 10:09:44 +0800 |
commit | 4d4f41c7cc831906100e10838b40c3b8d86657f2 (patch) | |
tree | bfc72beff5e1e9a8d907279446504f55239c8d31 /gui-pdp-monitoring/pom.xml | |
parent | 7fa12fdd8d4428a8b21ad143943858a1ca2e0e27 (diff) |
Setup js unit test and code coverage framework
(1) Use frontend-maven-plugin to integrate frontend development
(2) Use jest as test tool
(3) Use webpack to create webapp bundle
(4) Coverage data is saved in target/jscoverage
Issue-ID: POLICY-2311
Signed-off-by: huaxing <huaxing.jin@est.tech>
Change-Id: I34fb7487c1e0ca29114eb7accba8bb7c4812da34
Diffstat (limited to 'gui-pdp-monitoring/pom.xml')
-rw-r--r-- | gui-pdp-monitoring/pom.xml | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/gui-pdp-monitoring/pom.xml b/gui-pdp-monitoring/pom.xml index 553958c..b4ef307 100644 --- a/gui-pdp-monitoring/pom.xml +++ b/gui-pdp-monitoring/pom.xml @@ -30,6 +30,10 @@ <name>${project.artifactId}</name> <description>GUI for monitoring Pdps Statistics</description> + <properties> + <webapp.dir>src/webapp</webapp.dir> + </properties> + <dependencies> <dependency> <groupId>org.onap.policy.common</groupId> @@ -76,6 +80,90 @@ <outputDirectory>${project.build.directory}/classes</outputDirectory> <plugins> <plugin> + <groupId>com.github.eirslett</groupId> + <artifactId>frontend-maven-plugin</artifactId> + <version>1.9.1</version> + <configuration> + <nodeVersion>v9.9.0</nodeVersion> + <installDirectory>${webapp.dir}</installDirectory> + <workingDirectory>${webapp.dir}</workingDirectory> + </configuration> + <executions> + <execution> + <id>install node</id> + <goals> + <goal>install-node-and-npm</goal> + </goals> + <configuration> + <nodeVersion>v10.16.0</nodeVersion> + <npmVersion>6.9.0</npmVersion> + </configuration> + </execution> + <execution> + <id>npm install</id> + <goals> + <goal>npm</goal> + </goals> + </execution> + <execution> + <id>npm test</id> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>test</arguments> + </configuration> + </execution> + <execution> + <id>webpack build</id> + <goals> + <goal>webpack</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>Copy frontend build to target</id> + <phase>prepare-package</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/classes/webapp</outputDirectory> + <resources> + <resource> + <directory>${webapp.dir}/dist</directory> + <filtering>false</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <filesets> + <fileset> + <directory>${webapp.dir}/node</directory> + </fileset> + <fileset> + <directory>${webapp.dir}/node_modules</directory> + </fileset> + <fileset> + <directory>${webapp.dir}/dist/</directory> + <includes>bundle.js</includes> + </fileset> + </filesets> + </configuration> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> |