-
Notifications
You must be signed in to change notification settings - Fork 109
[Fixes #111] Update dependencies, get babel instrumenter working #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2b87b1b
2fa05e0
e3dcf3e
db2dd92
a3614d1
1de32e5
9760e1c
9991815
a0da20f
328533e
83b8c2c
0c21496
3559743
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| .editorconfig | ||
| .ember-cli | ||
| .gitignore | ||
| .jshintrc | ||
| .eslintrc.js | ||
| .watchmanconfig | ||
| .travis.yml | ||
| bower.json | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| /* eslint-env node */ | ||
| 'use strict'; | ||
|
|
||
| module.exports = function(/* environment, appConfig */) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ function Instrumenter(options) { | |
| this.babelOptions = extend({ | ||
| sourceMap: true | ||
| }, options && options.babel || {}); | ||
| this.plugins = options.plugins; | ||
|
|
||
| return this; | ||
| } | ||
|
|
@@ -33,6 +34,13 @@ Instrumenter.prototype = Object.create(istanbul.Instrumenter.prototype); | |
| Instrumenter.prototype.constructor = Instrumenter; | ||
|
|
||
| Instrumenter.prototype.instrumentSync = function(code, fileName) { | ||
| var plugins = this.babelOptions.plugins; | ||
| // If we're running in coverage, we're assuming that this is running in CI or in some | ||
| // form of test scenario and not being built for production. So it's fine to always | ||
| // force this plugin to work. | ||
| for (var plugin of this.plugins) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need to protect against prototype members here? (hasOwnProperty)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is normally going to be a simple array, but I can do it just to be absolutely safe.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we are safe here, because this is using "for...of" rather than "for...in". "for...of" only iterates over the elements of the collection: Object.prototype.objCustom = function() {};
Array.prototype.arrCustom = function() {};
let iterable = [3, 5, 7];
iterable.foo = 'hello';
for (let i in iterable) {
console.log(i); // logs 0, 1, 2, "foo", "arrCustom", "objCustom"
}
for (let i of iterable) {
console.log(i); // logs 3, 5, 7
}
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed that, Looks good. |
||
| plugins.push(plugin); | ||
| } | ||
| var result = this._r = (0, babelTransform)(code, extend({}, this.babelOptions, { filename: fileName })); | ||
| this._babelMap = new SourceMapConsumer(result.map); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,5 @@ | ||
| module.exports = { | ||
| env: { | ||
| 'embertest': true | ||
| }, | ||
| parserOptions: { | ||
| ecmaVersion: 6, | ||
| sourceType: 'module' | ||
| embertest: true | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /* eslint-env node */ | ||
|
|
||
| module.exports = { | ||
| useBabelInstrumenter: true | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /*jshint node:true*/ | ||
| /* eslint-env node */ | ||
|
|
||
| module.exports = { | ||
| parallel: true | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary to remove now that the use strict issue is resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I add that, then I get:
So which do you want, do you want the eslint rule or do you want the "use stricts"? Personally I'd rather have it hue closer to the default ember-cli blueprint, but that's just my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way you have it now is good