Skip to content

Commit

Permalink
Merge pull request #14 from serut/dev-0.9.4-integrate-glob
Browse files Browse the repository at this point in the history
Accept dev-0.9.4-integrate-glob
  • Loading branch information
serut committed Aug 28, 2016
2 parents 104945d + 1bd40c4 commit 7075ff7
Show file tree
Hide file tree
Showing 38 changed files with 1,920 additions and 1,496 deletions.
72 changes: 10 additions & 62 deletions .coverage.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,12 @@
{
"ignore": {
"clientside": {
"inapp": [
"/underscore.js",
"/meteor.js",
"/meteor-base.js",
"/mobile-experience.js",
"/babel-compiler.js",
"/ecmascript.js",
"/base64.js",
"/ejson.js",
"/id-map.js",
"/ordered-dict.js",
"/tracker.js",
"/modules-runtime.js",
"/modules.js",
"/es5-shim.js",
"/promise.js",
"/ecmascript-runtime.js",
"/babel-runtime.js",
"/random.js",
"/mongo-id.js",
"/diff-sequence.js",
"/geojson-utils.js",
"/minimongo.js",
"/check.js",
"/retry.js",
"/ddp-common.js",
"/reload.js",
"/ddp-client.js",
"/ddp.js",
"/ddp-server.js",
"/allow-deny.js",
"/insecure.js",
"/mongo.js",
"/blaze-html-templates.js",
"/reactive-var.js",
"/jquery.js",
"/standard-minifier-css.js",
"/standard-minifier-js.js",
"/autopublish.js",
"/dburles_eslint.js",
"/webapp.js",
"/livedata.js",
"/hot-code-push.js",
"/deps.js",
"/htmljs.js",
"/observe-sequence.js",
"/blaze.js",
"/spacebars.js",
"/templating.js",
"/launch-screen.js",
"/ui.js",
"/autoupdate.js",
"/global-imports.js"
]
},
"others": [
".*/tests/.*.js",
".*tests.js"
]
}
"exclude": {
"general": [
"/**/tests/**/*",
"**/tests/**/*",
"/**/*tests.js",
"/**/*test.js",
".npm/package/node_modules/**",
"**/lmieulet:meteor-coverage/**"
]
}
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
assets
.npm
.github
conf
76 changes: 66 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,68 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": 2
}
"extends": ["eslint:recommended"],
"plugins": ["babel", "mocha", "import"],
"parser": "babel-eslint",
"env":{
"es6": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"consistent-return": [0],
"eqeqeq": [2, "smart"],
"import/no-extraneous-dependencies": [0],
"mocha/no-exclusive-tests": "error",
"no-console": [0],
"no-debugger": [0],
"no-unused-vars": [0],
"no-undefined": [0],
"no-undef": [0],
"prefer-template": [0],
"no-mixed-requires": [0],
"quotes": [2, "single"],
"radix": [0],
"semi": [2, "always"],

"camelcase": 0,
"no-underscore-dangle": 0,

"indent": [2, 2],
"comma-dangle": [2, "never"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-empty": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 2,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-sparse-arrays": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"use-isnan": 2,

"block-scoped-var": 2,
"curly": [2, "multi-line"],
"default-case": 2,
"guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-case-declarations": 2,
"no-else-return": 2,
"no-labels": 2,
"no-empty-pattern": 2,
"no-eq-null": 2,
"no-eval": 2,

"import/no-mutable-exports": 0,
"import/no-unresolved": 0,
"import/named": 2,
"import/namespace": 2,
"import/export": 2,
"import/no-duplicates": 2
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.npm
.coverage
packages
node_modules
local-packages.json
.idea
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: node_js

node_js:
- 0.10.43
- 4.4.7

cache:
Expand All @@ -21,11 +20,12 @@ before_install:
# Install dependencies
- npm install -g https://github.com/serut/spacejam/tarball/windows-suppport-rc4
- npm install -g eslint coveralls codecov.io codacy-coverage
- meteor npm install

script:
- mkdir .coverage
- spacejam test-packages ./ --coverage out_lcovonly --driver-package practicalmeteor:mocha-console-runner
- meteor npm test
- cat .coverage/lcov.info | coveralls || cat .coverage/lcov.info || true # ignore coveralls error
- cat .coverage/lcov.info | codecov || cat .coverage/lcov.info || true # ignore codecov error
- cat .coverage/lcov.info | codacy-coverage || true # ignore codacy error
- eslint . || true # ignore eslint error
- meteor npm run lint || true # ignore eslint error
51 changes: 51 additions & 0 deletions .versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
allow-deny@1.0.4
babel-compiler@6.6.4
babel-runtime@0.1.8
base64@1.0.8
binary-heap@1.0.8
blaze@2.1.7
blaze-tools@1.0.8
boilerplate-generator@1.0.8
callback-hook@1.0.8
check@1.2.1
ddp@1.2.5
ddp-client@1.2.7
ddp-common@1.2.5
ddp-server@1.2.6
deps@1.0.12
diff-sequence@1.0.5
ecmascript@0.4.3
ecmascript-runtime@0.2.10
ejson@1.0.11
geojson-utils@1.0.8
html-tools@1.0.9
htmljs@1.0.9
id-map@1.0.7
jquery@1.11.8
lmieulet:meteor-coverage@0.8.0
lmieulet:meteor-coverage-self-instrumenter@2.0.0
local-test:lmieulet:meteor-coverage@0.8.0
logging@1.0.12
meteor@1.1.14
meteorhacks:picker@1.0.3
minimongo@1.0.16
modules@0.6.1
modules-runtime@0.6.3
mongo@1.1.7
mongo-id@1.0.4
npm-mongo@1.4.43
observe-sequence@1.0.11
ordered-dict@1.0.7
promise@0.6.7
random@1.0.9
reactive-var@1.0.9
retry@1.0.7
routepolicy@1.0.10
spacebars@1.0.11
spacebars-compiler@1.0.11
tinytest@1.0.10
tracker@1.0.13
ui@1.0.11
underscore@1.0.8
webapp@1.2.8
webapp-hashing@1.0.9
83 changes: 37 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# meteor-coverage

A meteor package that allows you to get the statement, line, function and branch coverage of Meteor project and package.
This package uses the [istanbuljs/istanbul-api](https://github.com/istanbuljs/istanbul-api) package for coverage report and [meteorhacks:picker](https://github.com/meteorhacks/picker) for server side routing.
This package uses the [istanbuljs/istanbul-api](https://github.com/istanbuljs/istanbul-api) package for coverage report.
It's a debug only package, so it does not affect your production build.

## CI Platforms supported
Expand All @@ -13,17 +13,14 @@ It's a debug only package, so it does not affect your production build.

## Installation

- In a Meteor app, add these dependencies to your `.meteor/packages` file :
- In a Meteor app, add these dependencies :

```txt
practicalmeteor:chai
practicalmeteor:mocha@2.4.5_5
practicalmeteor:mocha-console-runner
lmieulet:meteor-coverage@0.9.1
meteor add practicalmeteor:mocha
```

- If you are using flow-router, there are [an issue](https://github.com/kadirahq/flow-router/pull/615) that prevents tests to succeed.
- If you want to cover a package, you need to add `api.use(['lmieulet:meteor-coverage@0.9.1']);` to your `Package.onTest` function of the `package.js` file.
- If you want to cover a package, you need to add `api.use(['lmieulet:meteor-coverage@0.9.4']);` to your `Package.onTest` function of the `package.js` file.

#### Then test if it works

Expand Down Expand Up @@ -76,6 +73,8 @@ For app, edit your `package.json` with the following
Now, you can run your test (here is an extract of a [circle.yml](https://github.com/serut/meteor-coverage-app-exemple/blob/master/circle.yml)), merge coverage between tests, export the coverage report and sent it to a coverage platform:

- meteor npm install
# Create output directory
- mkdir .coverage
# Unit test using mocha
- meteor npm run test-coverage-app-unit
# Integration test using mocha
Expand All @@ -99,6 +98,7 @@ For packages, install spacejam globally and run it manually (as this package doe
- `out_html` creates a html report
- `out_json_report` creates a json report
- `out_json_summary` creates a json_summary report
- `out_text_summary` creates a text_summary report
- `out_teamcity` is not working yet

## Global environment variable
Expand All @@ -113,6 +113,8 @@ You need to set up these environment variables:
- Used when importing or exporting coverage reports
- `COVERAGE_VERBOSE=1` to see logs (optional)

Another way to enable coverage is to use the Meteor --settings file.

Using `spacejam --coverage` you do not have to set up global environment variable.

## My files are missing from my app coverage report
Expand All @@ -127,39 +129,34 @@ If you do not have this file, this package will use the default one (`conf/defau

Copy the `conf/default-coverage.json`, rename it into `.coverage.json`, remove keys that you don't want to overwrite and pimp it.

```json
{
"ignore": {
"clientside": {
"inapp": [
"You may want to ignore here modules from client side instrumentation",
"to get the lightest version of your browser app",
"/underscore.js",
"/meteor.js",
"...",
"And even dependencies / internal packages:",
"/lmieulet_meteor-coverage.js",
"==> if you cloned that package into your package directory",
"it will ignores all files stored in packages/meteor-coverage/* from client instrumentation"
],
"public": [
"if you have js in your public directory like",
"openlayers.min.js",
"==> stored in public/openlayers.min.js",
"and you don't want to instrument them"
]
},
"serverside": [
],
"others": [
"here you can ignore any file from your project coverage report",
".*/tests/.*.js"
]
},
"output": "./.coverage"
```json{
"include": [],
"exclude": {
"client": [
"You may want to exclude here modules from client side instrumentation",
"to get the lightest version of your browser app",
"**/underscore.js",
"**/meteor.js",
"...",
"And even dependencies / internal packages:",
"/lmieulet_meteor-coverage.js",
"==> if you cloned a package into your package directory",
"it will ignores the minified version of the package from client instrumentation"
],
"server": [
"same thing than client. "
],
"general": [
"here you can ignore anything from your project coverage report",
"**/tests/*.js"
]
},
"output": "./.coverage"
}
```

The minimatch syntax of this file can be found [here](http://hgbook.red-bean.com/read/file-names-and-pattern-matching.html#id381184).

To create your custom config file, run the project with `COVERAGE_VERBOSE=1` env variable and use logs to see which filenames were hooked or hidden. PR welcome.

## Client API
Expand Down Expand Up @@ -195,21 +192,16 @@ Import a `coverage` export.
Meteor.importCoverage(function(err) {console.log(err)})
```

## Limitation(s) / open issues

- `meteor --settings` support
- Need to add options when exporting
- No feedback from typescript and coffeescript users

## Contributing

Anyone is welcome to contribute.
Fork meteor-coverage-app-exemple, make and then submit a pull request.
Fork meteor-coverage-app-exemple (or use an empty meteor app), make and then submit a pull request.

Don't forget to test :

- set environment variables `COVERAGE` and `COVERAGE_APP_FOLDER` (e.g. `set COVERAGE 1` or `COVERAGE=1`)
- meteor test-packages
- meteor npm test
- meteor npm run lint:fix

## Credits

Expand All @@ -219,4 +211,3 @@ This package would not exist without the amazing work of:
- All contributors of [istanbul-api](https://github.com/istanbuljs/istanbul-api) and [istanbul-middleware](https://github.com/gotwarlost/istanbul-middleware) projects.

Both were very helpful in the development of this package. It saves me so many hours so many thanks to them.
.
Loading

0 comments on commit 7075ff7

Please sign in to comment.