From 615a0018fd68a7c3bb8e08a58be2e4b5c6a027dd Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Mon, 21 Nov 2016 07:07:42 -0500 Subject: [PATCH] code coverage --- .gitignore | 2 ++ .travis.yml | 1 + mocha.opts | 1 + package.json | 21 ++++++++++++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8d67a86cda..0667ab2dee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .DS_Store node_modules dist +.nyc_output +coverage diff --git a/.travis.yml b/.travis.yml index 92804dc881..eddea4d96c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,4 @@ env: global: - BUILD_TIMEOUT=10000 install: npm install +after_success: npm run coverage diff --git a/mocha.opts b/mocha.opts index ef3568a0f4..a7c5a25ba4 100644 --- a/mocha.opts +++ b/mocha.opts @@ -1 +1,2 @@ +--require babel-register --require reify diff --git a/package.json b/package.json index 5573710350..6d2f26c25f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "dist/svelte.umd.js", "module": "dist/svelte.es.js", "scripts": { - "test": "mocha --opts mocha.opts --recursive ./**/__test__.js test/test.js", + "test": "nyc mocha --opts mocha.opts --recursive ./**/__test__.js test/test.js", + "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "eslint compiler", "build": "rollup -c", "prebuild": "npm test", @@ -28,11 +29,16 @@ }, "homepage": "https://github.com/sveltejs/svelte#README", "devDependencies": { + "babel-plugin-istanbul": "^3.0.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", + "babel-register": "^6.18.0", + "codecov": "^1.0.1", "eslint": "^3.10.2", "eslint-plugin-import": "^2.2.0", "jsdom": "^9.8.3", "mocha": "^3.1.2", "node-resolve": "^1.3.3", + "nyc": "^9.0.1", "reify": "^0.4.0", "rollup": "^0.36.3", "rollup-plugin-node-resolve": "^2.0.0" @@ -42,5 +48,18 @@ "estree-walker": "^0.3.0", "locate-character": "^2.0.0", "magic-string": "^0.16.0" + }, + "nyc": { + "include": [ + "compiler/**/*.js" + ], + "exclude": [ + "compiler/**/__test__.js" + ] + }, + "babel": { + "plugins": [ + "transform-es2015-modules-commonjs" + ] } }