Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,8 @@ insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
128 changes: 41 additions & 87 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,98 +1,52 @@
/* jshint ignore:start */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true,
node: true
browser: true
},
rules: {
// JSHint "expr"
'no-unused-expressions': [2, {
allowShortCircuit: true,
allowTernary: true,
}],

// JSHint "proto", disabled due to warnings
'no-proto': 0,

// JSHint "indent", disabled due to warnings
'indent': [2, 2, {
'SwitchCase': 1,
'VariableDeclarator': { 'var': 2, 'let': 2, 'const': 3 }
}],

// JSHint "camelcase"
camelcase: 2,

// JSHint "boss"
'no-cond-assign': [2, 'except-parens'],

// JSHint "curly"
curly: 2,

// JSHint "latedef"
'no-use-before-define': [2, 'nofunc'],

// JSHint "debug", disabled already in .jshintrc
'no-debugger': 0,

// JSHint "eqeqeq"
eqeqeq: 2,

// JSHint "evil"
'no-eval': 2,

// JSHint "forin", disabled already in .jshintrc
'guard-for-in': 0,

// JSHint "immed", disabled already in .jshintrc
'wrap-iife': 0,

// JSHint "laxbreak"
'linebreak-style': [2, 'unix'],

// JSHint "newcap
'new-cap': [2, {
properties: false,
}],

// JSHint "noarg"
'no-caller': 2,

// JSHint "noempty", JSCS "disallowEmptyBlocks"
'no-empty': 2,

// JSHint "quotmark", disabled due to warnings
quotes: [0, 'single'],

// JSHint "nonew", disabled already in .jshintrc
'no-new': 0,

// JSHint "plusplus", disabled already in .jshintrc
'no-plusplus': 0,

// JSHint "undef"
'no-undef': 2,

// JSHint "unused"
'no-unused-vars': 2,

// JSHint "sub", disabled due to warnings
'dot-notation': 0,

// JSHint "trailing"
'no-trailing-spaces': 2,

// JSHint "eqnull"
'no-eq-null': 2,

'no-console': 0,
'comma-dangle': 0,
},
overrides: [
// node files
{
files: [
'index.js',
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'lib/**',
'test/**',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'app/**',
'addon/**',
'tests/dummy/app/**'
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
env: {
browser: false,
node: true
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
'no-console': 'off',
'no-useless-escape': 'off',
'node/no-unpublished-require': 'off'
})
}
]
};
/* jshint ignore:end */
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
/.sass-cache
/connect.lock
/coverage/*
/coverage_*
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.bowerrc
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ branches:
- auto
- /^greenkeeper.*$/

addons:
chrome: stable

cache:
directories:
- node_modules
yarn: true

env:
- NPM_SCRIPT=node-test
Expand All @@ -24,17 +26,14 @@ matrix:
fast_finish: true
include:
- node_js: "6"
env: NPM_SCRIPT=lint
env: NPM_SCRIPT=lint:js

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm config set spin false
- npm install -g npm@^2
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

install:
- npm install
- yarn install --no-lockfile --non-interactive

script:
- npm run-script $NPM_SCRIPT
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Code coverage using [Istanbul](https://github.com/gotwarlost/istanbul) for Ember
* If using Mocha, Testem `>= 1.6.0` for which you need ember-cli `> 2.4.3`
* If using Mirage you need `ember-cli-mirage >= 0.1.13`
* If using Pretender (even as a dependency of Mirage) you need `pretender >= 0.11.0`
* If using Mirage or Pretender, you need to [set up a passthrough for coverage to be written](#create-a-passthrough-when-intercepting-all-ajax-requests-in-tests).
* If using Mirage or Pretender, you need to [set up a passthrough for coverage to be written](#create-a-passthrough-when-intercepting-all-ajax-requests-in-tests).
* `ember-cli-babel >= 6.0.0`


## Installation
Expand All @@ -33,7 +34,7 @@ When running with `parallel` set to true, the final reports can be merged by usi

## Configuration

Configuration is optional. It should be put in a file at `config/coverage.js` (`configPath` configuration in package.json is honored)
Configuration is optional. It should be put in a file at `config/coverage.js` (`configPath` configuration in package.json is honored). In addition to this you can configure Istanbul by adding a `.istanbul.yml` file to the root directory of your app (See https://github.com/gotwarlost/istanbul#configuring)

#### Options

Expand All @@ -45,10 +46,6 @@ Configuration is optional. It should be put in a file at `config/coverage.js` (`

- `coverageFolder`: Defaults to `coverage`. A folder relative to the root of your project to store coverage results.

- `useBabelInstrumenter`: Defaults to `false`. Whether or not to use Babel instrumenter instead of default instrumenter. The Babel instrumenter is useful when you are using features of ESNext as it uses your Babel configuration defined in `ember-cli-build.js`.

- `babelPlugins`: Defaults to `['babel-plugin-transform-async-to-generator']`. When using the Babel instrumenter, this specifies a set of additional plugins to pass to the parser. Use this to parse specific ESNext features you may be using in your app (decorators, for instance).

- `parallel`: Defaults to `false`. Should be set to true if parallel testing is being used, for example when using [ember-exam](https://github.com/trentmwillis/ember-exam) with the `--parallel` flag. This will generate the coverage reports in directories suffixed with `_<random_string>` to avoid overwriting other threads reports. These reports can be joined by using the `ember coverage-merge` command (potentially as part of the [posttest hook](https://docs.npmjs.com/misc/scripts) in your `package.json`).

#### Example
Expand All @@ -58,7 +55,7 @@ Configuration is optional. It should be put in a file at `config/coverage.js` (`
}
```

## Create a passthrough when intercepting all ajax requests in tests
## Create a passthrough when intercepting all ajax requests in tests

To work, this addon has to post coverage results back to a middleware at `/write-coverage`.

Expand Down
3 changes: 3 additions & 0 deletions addon/utils/my-covered-util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function myCoveredUtil() {
return true;
}
3 changes: 3 additions & 0 deletions addon/utils/my-uncovered-util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function myUncoveredUtil() {
return true;
}
1 change: 1 addition & 0 deletions app/utils/my-covered-util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-cli-code-coverage/utils/my-covered-util';
2 changes: 2 additions & 0 deletions app/utils/my-uncovered-util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from 'ember-cli-code-coverage/utils/my-uncovered-util';

63 changes: 63 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');

module.exports = function() {
return Promise.all([
getChannelURL('release'),
getChannelURL('beta'),
getChannelURL('canary'),
]).then((urls) => {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.12',
npm: {
devDependencies: {
'ember-source': '~2.12.0'
}
}
},
{
name: 'ember-lts-2.16',
npm: {
devDependencies: {
'ember-source': '~2.16.0'
}
}
},
{
name: 'ember-release',
npm: {
devDependencies: {
'ember-source': urls[0]
}
}
},
{
name: 'ember-beta',
npm: {
devDependencies: {
'ember-source': urls[1]
}
}
},
{
name: 'ember-canary',
npm: {
devDependencies: {
'ember-source': urls[2]
}
}
},
{
name: 'ember-default',
npm: {
devDependencies: {}
}
}
]
};
});
};
1 change: 0 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
'use strict';

module.exports = function(/* environment, appConfig */) {
Expand Down
3 changes: 1 addition & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-env node */
'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
let app = new EmberAddon(defaults, {
// Add options here
'ember-cli-babel': {
// Used by the dummy app, doesn't affect the host app
Expand Down
Loading