Skip to content

Commit 6d3060b

Browse files
committed
added coverage
1 parent efcad70 commit 6d3060b

File tree

11 files changed

+55
-20
lines changed

11 files changed

+55
-20
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
dist
22
npm-debug.log
33
example/example-react.js
4-
webpack.config.template.js
4+
webpack.config.template.js
5+
6+
# Coverage directory used by tools like istanbul
7+
coverage

.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ example
77
.git
88
.gitignore
99
example/example-react.js
10-
webpack.config.template.js
10+
webpack.config.template.js
11+
12+
# Coverage directory used by tools like istanbul
13+
coverage

.nycrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": [
3+
"/react/test/helpers/browser.js"
4+
]
5+
}

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ services:
44
- docker
55

66
before_install:
7-
- ./docker/build.sh
7+
- ./docker/build.sh
8+
9+
after_success: npm run coverage
810

911
language: node_js
1012
node_js:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MAINTAINER mac <[email protected]>
33

44
# install the node modules at container build time
55
ADD package.json /tmp/package.json
6-
RUN cd /tmp && npm install
6+
RUN cd /tmp && npm install --silent
77
RUN mkdir -p /react && cp -a /tmp/node_modules /react
88

99
# Now add our project code

docker/coverage.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# runs webpack in react container
3+
4+
NODE_ENV=${1:-local}
5+
echo "Running with NODE_ENV=$NODE_ENV"
6+
7+
rm -rf ./coverage/*
8+
9+
# run the workbench container
10+
docker run \
11+
-v $(pwd)/src:/react/src \
12+
-v $(pwd)/example:/react/example \
13+
-v $(pwd)/entrypoints:/react/entrypoints \
14+
-v $(pwd)/coverage:/react/coverage \
15+
-v $(pwd)/webpack.config.js:/react/webpack.config.js \
16+
-v $(pwd)/test:/react/test \
17+
--rm \
18+
-e NODE_ENV=$NODE_ENV \
19+
--entrypoint=/react/entrypoints/coverage.sh \
20+
-t react-json-view

docker/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
NODE_ENV=${1:-local}
55
echo "Running with NODE_ENV=$NODE_ENV"
66

7+
rm -rf ./coverage/*
8+
79
# run the workbench container
810
docker run \
911
-v $(pwd)/src:/react/src \
1012
-v $(pwd)/example:/react/example \
1113
-v $(pwd)/entrypoints:/react/entrypoints \
14+
-v $(pwd)/coverage:/react/coverage \
1215
-v $(pwd)/webpack.config.js:/react/webpack.config.js \
1316
-v $(pwd)/test:/react/test \
1417
--rm \

entrypoints/coverage.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
echo Running Coverage Report
3+
4+
cd /react
5+
6+
exec npm run unit_test && npm run coverage

entrypoints/test.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/bin/bash
2-
# runs webpack dev server /react directory
2+
echo Running Tests
33

4-
# create the build directory if it doesn't exist
5-
echo Creating dist dir...
6-
mkdir -p /react/dist || true
7-
8-
cp /react/src/html/index.html.template /react/dist/index.html
94
cd /react
105

116
exec npm run unit_test

entrypoints/test_watch.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
#!/bin/bash
2-
# runs webpack dev server /react directory
3-
4-
# create the build directory if it doesn't exist
5-
echo Creating dist dir...
6-
mkdir -p /react/dist || true
7-
8-
cp /react/src/html/index.html.template /react/dist/index.html
2+
echo Running Tests
93
cd /react
104

115
exec npm run test:watch

0 commit comments

Comments
 (0)