Skip to content

Commit

Permalink
Merge pull request #38 from mac-s-g/coveralls
Browse files Browse the repository at this point in the history
covering all of source
  • Loading branch information
mac-s-g committed May 6, 2017
2 parents 135f7f3 + 4a4e43f commit 3615a78
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"plugins": [
'transform-class-properties',
'transform-decorators-legacy',
'react-html-attrs',
'transform-function-bind'
],
"presets": ["react", "es2015", "stage-0"]
}
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service-name: travis-ci
repo_token: vgY2Lq1R7eqlkcmpp4wU32xZI7JskTACs
5 changes: 4 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plugins": ["transform-decorators-legacy"],
"require": [
"/react/test/helpers/browser.js"
"babel-register",
"/react/test/helpers/browser.js",
"/react/test/helpers/requireSources.js"
]
}
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
before_install:
- ./docker/build.sh

after_success: npm run coverage

language: node_js
node_js:
- "7"
6 changes: 6 additions & 0 deletions docker/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ echo "Running with NODE_ENV=$NODE_ENV"

rm -rf ./coverage/*

mkdir .nyc_output

# run the workbench container
docker run \
-v $(pwd)/src:/react/src \
-v $(pwd)/example:/react/example \
-v $(pwd)/entrypoints:/react/entrypoints \
-v $(pwd)/coverage:/react/coverage \
-v $(pwd)/webpack.config.js:/react/webpack.config.js \
-v $(pwd)/.nyc_output:/react/.nyc_output \
-v $(pwd)/test:/react/test \
--rm \
-e NODE_ENV=$NODE_ENV \
--entrypoint=/react/entrypoints/coverage.sh \
-t react-json-view


rm -rf .nyc_output
6 changes: 5 additions & 1 deletion entrypoints/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ echo Running Coverage Report

cd /react

exec npm run unit_test && npm run coverage
echo Running: npm run unit_test
npm run unit_test

echo Running: npm run coverage
npm run coverage
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"coverage": "nyc report --reporter=text-lcov | coveralls",
"dev:hot": "webpack-dev-server",
"start": "node server.js",
"test": "./docker/test.sh",
"test": "./docker/coverage.sh",
"test:watch": "mocha -w /react/test/helpers/browser.js /react/test/**/*test.js",
"unit_test": "nyc --reporter=html --reporter=text mocha /react/test/**/*test.js"
"unit_test": "nyc --reporter=html --reporter=text-lcov --reporter=text mocha /react/test/**/*test.js"
},
"repository": {
"type": "git",
Expand Down
4 changes: 1 addition & 3 deletions test/helpers/browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require('babel-register')();

var jsdom = require('jsdom').jsdom;

var exposedProperties = ['window', 'navigator', 'document'];
Expand All @@ -17,4 +15,4 @@ global.navigator = {
userAgent: 'node.js'
};

documentRef = document;
var documentRef = document;
1 change: 1 addition & 0 deletions test/helpers/requireSources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '/react/src/js/index';
11 changes: 1 addition & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,7 @@ const config = {
test: /\.jsx?$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['react', 'es2015', 'stage-0'],
plugins: [
'transform-class-properties',
'transform-decorators-legacy',
'react-html-attrs',
'transform-function-bind'
]
}
loader: 'babel-loader'
}
],
include: [PATHS.js, PATHS.example]
Expand Down

0 comments on commit 3615a78

Please sign in to comment.