ember-cli-code-coverage / ember-cli-code-coverage Goto Github PK
View Code? Open in Web Editor NEWCode coverage for ember apps using Istanbul
Code coverage for ember apps using Istanbul
I've been toggling between v0.2.2 and v0.3.0 (or v0.3.1) and I'm getting a cryptic error in the new one.
1..1163
# tests 1163
# pass 1141
# skip 22
# fail 0
# ok
Error: request aborted
at IncomingMessage.onAborted (/my-project-path/node_modules/raw-body/index.js:269:10)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at abortIncoming (_http_server.js:280:11)
at Socket.serverSocketCloseListener (_http_server.js:293:5)
at emitOne (events.js:101:20)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:493:12)
And it doesn't create the coverage folder. It worked fine in the older version. I'm not using mirage or pretender.
Hello There
I have the following in in config/converage.js
module.exports = {
// This is default value
coverageEnvVar: 'COVERAGE',
// More reporters found here https://github.com/gotwarlost/istanbul/tree/master/lib/report
reporters: ['lcov', 'html'],
// Defaults to ['*/mirage/**/*']
excludes: [
"/blueprints",
"/config",
"/public",
"/tmp",
"*/tests/dummy\/(.*)/",
"/vendor"
],
// Defaults to coverage. A folder relative to the root of your project to store coverage results.
coverageFolder: coverage,
// Set to true or false if you are using ESNext features.
useBabelInstrumenter: true
}
But in the converage folder generated I see the following files
addon, app, lcov-report, test/dummy
What am I doing wrong here?
Library Versions:
Pods? Yes
When I run tests with COVERAGE=true
inside an addon, I don't see the templates included in the coverage like they are inside standard ember apps.
Hey there, I happen to have parked the ember-cli-istanbul
package in npm (having fully planned to implement it, but priorities shifted at work π¦ ) Would you like to take over ownership of that?
As of currently (v0.2.0) addon support for test coverage is not present. After testing it with my addon, Im only getting coverage for app/resolver.js
which is pretty meaningless. Im opening up this issue to track the progress for this. Once this lands, ill go ahead and replace blanketjs with this in ember-addon-genie.
Assuming Mocha has a similar hook, this can be done similarly to support for QUnit for older testem or /tests
users as done here https://github.com/kategengler/ember-cli-code-coverage/blob/master/lib/templates/test-body-footer.html#L42
Main blocker to adding this is not having an app that uses Mocha for ember tests.
I did not get any coverage information for files within the addon subdirectory. This problem seems to be specific for windows environments. It seems, that the function here
_doesFileExistIsCurrentProjectAddonModule: function(relativePath) {
relativePath = path.join('addon', relativePath.replace(path.join('modules', this.project.pkg.name),''));
if (this._existsSync(relativePath)) {
return true;
}
return this._doesTemplateFileExist(relativePath);
},
in index.js has problems with the path separator on Windows ("/" vs. ""). Inserting relativePath = path.join(relativePath);
as the first line in this function seems to solve this issue but this is most probably not the best solution. (I am not an expert on this...)
Hi
After running COVERAGE=true ember test
and opening coverage_summary.json
file, the file shows that json is not totally formatted. And adding '}' in the end takes care of the issue. Just wanted to report the issue.
I'm getting a strange error that I can't debug when I turn code-coverage on.
not ok 439 PhantomJS 2.1 - Global error: error requiring file for coverage: acl/blueprints/page-object-component at http://localhost:4201/assets/acl/vendor.js, line 228
---
Log: |
{ type: 'error',
text: 'error requiring file for coverage: acl/blueprints/page-object-component at http://localhost:4201/assets/acl/vendor.js, line 228\n' }
...
Weird thing is that I'm not using page-object-component
anywhere so I'm not sure why its getting tested or pulled in. Also my project only has 438 tests so I'm guessing test 439 is one added by code-coverage? I'm running ember-lts (2.8), "ember-cli-code-coverage": "0.3.6", "ember-cli-mocha": "^0.10.4", "ember-cli-page-object": "1.3.0", and also using the babel instrumentor.
Even weirder, when I load up tests in a browser I can actually see acl/blueprints/page-object-component
in my devtools.
We are currently running ember-cli-code-coverage
along with ember-exam
parallel runner.
This works great, however, the downside is, that coverage is generated on a console for each ember-exam
partition separately.
Is there a way, to merge the reports to obtain one coverage report?
Starting from Version 0.3.3 the parameter name
in _filterOutAddonFiles
is a function and not the actual name. This issue seems fixed when changing line 255 (function _parentName) from
return this.parent.name;
to
return this.parent.pkg.name;
ember-cli: 2.10.0 ( also repro in previous version )
ember: 2.10.0
ember-cli-code-coverage: 0.38.0
ember t
everything is good with no errors and proper termination. COVERAGE=true ember t
everything succeeds and the coverage is generated as expected, but the process never terminates. When I run it in DEBUG="*" mode it seems to hang with:
engine:ws writing "3" +0ms
engine:ws received "2" +25s
engine:socket packet +0ms
engine:socket got ping +0ms
engine:socket sending packet "pong" (undefined) +0ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "3" +0ms
engine:ws received "2" +25s
engine:socket packet +0ms
engine:socket got ping +0ms
engine:socket sending packet "pong" (undefined) +0ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "3" +0ms
engine:ws received "2" +25s
engine:socket packet +0ms
engine:socket got ping +0ms
engine:socket sending packet "pong" (undefined) +0ms
engine:socket flushing buffer to transport +0ms
engine:ws writing "3" +0ms
Looked into debugging phantom js but found no obvious errors.
From #58
There is a place that changes the displayed filenames in the instrumenter: https://github.com/kategengler/ember-cli-code-coverage/blob/master/lib/coverage-instrumenter.js#L27
Is it possible to do this massaging there?
Another potentially relevant spot: https://github.com/kategengler/ember-cli-code-coverage/blob/master/index.js#L129
Works fine with ember test --server
(testem, qunit)
testem.js
/*jshint node:true*/
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
};
With ember test
# tests 1272
# pass 1272
# skip 0
# fail 0
# ok
Error: request aborted
at IncomingMessage.onAborted (/home/office/myapp/frontend/node_modules/ember-cli-code-coverage/node_modules/body-parser/node_modules/raw-body/index.js:269:10)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at abortIncoming (_http_server.js:283:11)
at Socket.serverSocketCloseListener (_http_server.js:296:5)
at emitOne (events.js:101:20)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:493:12)
Is this expected?
"ember-cli": "2.8.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.6",
"ember-cli-chart": "3.1.0",
"ember-cli-code-coverage": "0.3.4",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars": "^1.0.3",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-moment-shim": "2.2.1",
"ember-cli-qunit": "^2.1.0"
After I resolve #7, I saw that the paths in "lcov.info" are not right. I was getting in my coveralls logs Error: ENOENT: no such file or directory, open '/home/travis/build/kellyselden/package-hint-historic-resolver/package-hint-historic-resolver/adapters/application.js'
. It seems the second "app name" needs to be either "app" or "addon" for the path to be correct for coveralls and maybe other reporters.
Currently lcov.info
namespaces addon code as: SF:modules/addon-name/models/ab.js
It should be: SF:addon/models/ab.js
so that code coverage tools like Coveralls can properly parse the file.
I solved this using sed s/SF:modules\\/addon-name/SF:addon/
in my build jobs, but we probably should work on properly renaming it and save everyone the trouble. If someone could point me to some lines or functions to look at for context, I'll take it on.
It looks like files compiled from CoffeeScript (using ember-cli-coffeescript) are not included when calculating code coverage. They don't show up on any of the reports.
After ember-cli-code-coverage used following command "COVERAGE=true ember test" to run the test
getting following error:
{ type: 'error',
text: 'Error: Pretender intercepted POST /write-coverage but no handler was defined for this type of request at http://localhost:7357/assets/vendor.js, line 68809\n' }
Do I need to do any configuration on my end?
//env:
Package.json
"devDependencies": {
"broccoli-asset-rev": "^2.2.0",
"ember-ajax": "0.7.1",
"ember-cli": "2.5.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.5",
"ember-cli-code-coverage": "0.2.2",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-pretender": "0.6.0",
"ember-cli-qunit": "^1.1.0",
"ember-cli-release": "0.2.8",
"ember-cli-sri": "^2.0.0",
"ember-cli-uglify": "^1.2.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-load-initializers": "0.5.1",
"ember-resolver": "^2.0.3",
"loader.js": "4.0.10"
}
Bower.json:
"dependencies": {
"ember": "2.5.0",
"ember-cli-shims": "0.1.0",
"ember-cli-test-loader": "0.2.2",
"ember-load-initializers": "0.1.7",
"ember-qunit-notifications": "0.1.0",
"jquery": "1.11.3",
"loader.js": "^3.5.0",
"qunit": "~1.20.0",
"pretender": "^0.12.0",
"bootstrap": "3.1.1",
"moment": "~2.11.1",
"markdown": "~0.5.0",
"bootstrap-tokenfield": "~0.12.1"
},
Should we use ESLint instead of JSHint? I see ESLint is already used, so should we swap out and do ember-cli-eslint to use all ESLint?
I have this version of ember-cli-code-coverage in my package.json "ember-cli-code-coverage": "0.3.8". Also I have a coverage file in this root path in my ember app.
config/coverage.js
module.exports = {
// This is default value
coverageEnvVar: 'COVERAGE',
// More reporters found here https://github.com/gotwarlost/istanbul/tree/master/lib/report
reporters: ['lcov', 'json', 'json-summary', 'text', 'text-summary'],
// Defaults to ['*/mirage/**/*']
excludes: [
"/blueprints",
"/config",
"/public",
"/tmp",
"/tests/dummy/**",
"/vendor"
],
// Defaults to coverage. A folder relative to the root of your project to store coverage results.
// Set to true or false if you are using ESNext features.
useBabelInstrumenter: true
}
I have the following folder structure
β ember-webrtc-devices git:(master) tree -d -L 3 -I 'node_modules|bower_components'
.
βββ addon
βΒ Β βββ components
βΒ Β βΒ Β βββ device-selection
βΒ Β βββ mixins
βββ app
βΒ Β βββ components
βΒ Β βΒ Β βββ device-selection
βΒ Β βββ mixins
βΒ Β βββ translations
βΒ Β βββ webrtc-devices
βββ blueprints
βΒ Β βββ ember-webrtc-devices
βββ config
βββ coverage
βΒ Β βββ lcov-report
βΒ Β βββ addon
βΒ Β βββ app
βΒ Β βββ tests
βββ public
βΒ Β βββ assets
βΒ Β βββ sounds
βββ scripts
βββ tests
βΒ Β βββ dummy
βΒ Β βΒ Β βββ app
βΒ Β βΒ Β βββ config
βΒ Β βΒ Β βββ public
βΒ Β βββ helpers
βΒ Β βββ integration
βΒ Β βΒ Β βββ components
βΒ Β βββ unit
βΒ Β βββ mixins
βββ tmp
βββ typings
βΒ Β βββ ember
βββ vendor
36 directories
When I run npm run coverage
which runs "coverage": "COVERAGE=true ember test"
I got the following code coverage report.
------------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Lines |
---|---|---|---|---|---|
addon/components/device-selection/ | 62.5 | 53.85 | 62.5 | 57.14 | |
component.js | 62.5 | 53.85 | 62.5 | 57.14 | ... ,97,115,126 |
addon/mixins/ | 29.82 | 19.74 | 33.33 | 25.23 | |
device-enumeration.js | 29.82 | 19.74 | 33.33 | 25.23 | ... 267,268,270 |
app/components/device-selection/ | 100 | 100 | 100 | 100 | |
component.js | 100 | 100 | 100 | 100 | |
tests/dummy/app/ | 100 | 100 | 0 | 100 | |
app.js | 100 | 100 | 100 | 100 | |
resolver.js | 100 | 100 | 100 | 100 | |
router.js | 100 | 100 | 0 | 100 | |
tests/dummy/app/initializers/ | 100 | 100 | 100 | 100 | |
webrtc-service.js | 100 | 100 | 100 | 100 | |
tests/dummy/app/services/ | 0 | 100 | 0 | 0 | |
webrtc.js | 0 | 100 | 0 | 0 | 13,14,18,19 |
------------------------------------ | ---------- | ---------- | ---------- | ---------- | ---------------- |
All files | 41.04 | 28.43 | 43.18 | 36.25 | |
------------------------------------ | ---------- | ---------- | ---------- | ---------- | ---------------- |
Since I specifically excluded tests/dummy why is code coverage reporting it is touched
I seem to have an issue with v 0.3.6+ of ember-cli-code-coverage.
Running COVERAGE=true ember test
kept failing after the last test was run ie when coverage would normally start. Its not repo specific. Doesnt matter what the tests are, this error always shows up at the end
not ok 29 Chrome 54.0 - FrostNavigationService "after each" hook
---
message: >
Uncaught TypeError: Cannot convert undefined or null to object (http://localhost:7357/5392/tests/index.html?hidepassed:43)
stack: >
Error: Uncaught TypeError: Cannot convert undefined or null to object (index.html?hidepassed:43)
at global.onerror (http://localhost:7357/assets/test-support.js:8732:10)
Log: |
I have pin pointed this to version 0.3.6 of ember-cli-code-coverage. Up to 0.3.5 everything works great. If you pin to v 0.3.5, coverage is reported properly. Could be related to this PR https://github.com/kategengler/ember-cli-code-coverage/pull/62/files
@rwjblue @rwwagner90
Now that we are requiring all files, issues like #65, #66, and #75 are popping up, and the problem may not be immediately clear. We also have files we want to stop covering in #71. I propose we unify any API to resolve these issues, or at least make them compatible. Maybe both a shouldInclude
and a shouldExclude
hook. That's about as far as I got in the thought process.
I'm trying to set-up coverage on my Ember testing, but I can't seem to get this to work.
I've run ember install ember-cli-code-coverage
. It is now in my node_modules folder.
I've tried adding coverage
and COVERAGE
parameters to the test_page property in testem.js e.g.
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed&coverage",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
}
But when I run ember test
or ember test --server
, I'm not seeing any coverage files/folders generated. The tests are running without any issues or errors.
I'm assuming there's something obvious I'm not doing, based on seeing a few folk on Stack Overflow successfully using this module.
I'm running:
Had an extensive chat with @rwjblue on things we want to implement, one of them is we should be able to return null
from fixPath
to avoid instrumenting.
Been trying to get code coverage working for ember-ajax
but am running into an issue. When running
$ COVERAGE=true ember test
the tests start, run fine, and generate the coverage
directory. However, the process never exists. Some configuration options that might be relevant:
ember-cli v2.8.0
ember-cli-pretender v0.7.0
pretender v1.2.0
If you want to try it out, I've pushed a branch here with ember-cli-code-coverage
installed and an old version of Pretender that I thought might be causing trouble removed (although it didn't help).
I dug into the Testem middleware a bit, thinking that might be the cause of the problem. Everything seems to be working fine there; that code exists and all. Not really sure where to look from there.
Only reports coverage in the app/
folder and not in the addon/
folder
We have an npm scope associated with our private registry, so our internal addons all have scoped package names like @scope/foo-bar
. They use the unscoped version (foo-bar
) for the name in their index.js
, which unfortunately causes ember-cli-code-coverage to filter out all our actual addon files.
Locally, I've had success replacing instances of project.pkg.name
with project.name()
, which returns the package's "base name" (everything after the last /
). It works for our use case, and I started to open a PR with that change, but it doesn't seem like it solves the underlying problem βΒ the name in package.json
and the name in index.js
aren't necessarily related.
Given that the covered addon is looked up by name here, it seems like kind of a catch-22 unless there's another way to track down the Addon
instance without knowing its name. Any guidance on this? Are mismatched package and addon names even something this addon needs to handle, or is it enough of an antipattern that it should just be discouraged?
I am running tests with code-coverage on and using ember-cli-yadda and yadda. Yadda is setting ember's global require()
to its own function. This makes the coverage reporting fail in the script inserted into tests/index.html at this line of code. Since global require()
is no longer ember's function, require.entries
is undefined.
requirejs
and requireModule
are both still set to ember's function.
Other than asking yadda to not clobber require()
, do you have any suggestions on a good way to have ember-cli-code-coverage work around this?
I am using v0.3.6, ember-cli/ember v2.9.1.
I wonder if it is possible to add thresholds checking to the ember-cli build process.
Hi guys, while trying out #31 using:
ember-cli: 2.7.0
node: 0.12.6
os: darwin x64
phantomjs: 1.9.8
I (accidentally) tried out the current master and started having a problem with a global error. After a bit of digging it seems that f2ba0e8 causes a broken test on a fresh addon, with just ember-cli-mocha installed when running Coverage=true ember test
ok 1 PhantomJS 1.9 - JSHint | app.js should pass jshint
ok 2 PhantomJS 1.9 - JSHint | helpers/destroy-app.js should pass jshint
ok 3 PhantomJS 1.9 - JSHint | helpers/module-for-acceptance.js should pass jshint
ok 4 PhantomJS 1.9 - JSHint | helpers/resolver.js should pass jshint
ok 5 PhantomJS 1.9 - JSHint | helpers/start-app.js should pass jshint
ok 6 PhantomJS 1.9 - JSHint | resolver.js should pass jshint
ok 7 PhantomJS 1.9 - JSHint | router.js should pass jshint
ok 8 PhantomJS 1.9 - JSHint | test-helper.js should pass jshint
not ok 9 PhantomJS 1.9 - Global error: INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable. at http://localhost:7357/8472/tests/index.html?hidepassed, line 48
---
Log: |
{ type: 'error',
text: 'INVALID_STATE_ERR: DOM Exception 11: An attempt was made to use an object that is not, or is no longer, usable. at http://localhost:7357/8472/tests/index.html?hidepassed, line 48\n' }
After a quick look at the changes in the commit mentioned above, I found that by removing:
request.send(data);
request.responseType = 'json';
... and moving callback()
out of the onload handler, it ran without error, but I'm not sure how a proper fix should look.
The tests run fine in Chrome, and are also fine without specifying COVERAGE=true.
[EDIT] Phantomjs 2.1 seems to have the same issue, but doesn't log the error - it just hangs after test 8.
I'm testing out the difference between 0.3.5 and 0.3.7 in my app. 0.3.5 generates the coverage folder. 0.3.6 threw on requiring invalid files. 0.3.7 doesn't generate the coverage folder, and shows this at the end of the console:
1..1258
# tests 1258
# pass 1237
# skip 21
# fail 0
# ok
Error
at IncomingMessage.onAborted (/my-project/node_modules/raw-body/index.js:269:10)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at abortIncoming (_http_server.js:284:11)
at Socket.serverSocketCloseListener (_http_server.js:297:5)
at emitOne (events.js:101:20)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:501:12)
ReferenceError: [BABEL] app/adapters/application.js: Unknown option: direct.includePolyfill
at Logger.error (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/file/logger.js:58:11)
at OptionManager.mergeOptions (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:29)
at OptionManager.init (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/file/options/option-manager.js:216:10)
at File.initOptions (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/file/index.js:147:75)
at new File (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/file/index.js:137:22)
at Pipeline.transform (/home/lolmaus/Code/launchpad2/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
at Instrumenter.instrumentSync (/home/lolmaus/Code/launchpad2/node_modules/ember-cli-code-coverage/lib/babel-istanbul-instrumenter.js:36:45)
at CoverageInstrumenter.processString (/home/lolmaus/Code/launchpad2/node_modules/ember-cli-code-coverage/lib/coverage-instrumenter.js:100:23)
at CoverageInstrumenter.processFile (/home/lolmaus/Code/launchpad2/node_modules/broccoli-filter/index.js:165:31)
at asyncProcessFile (/home/lolmaus/Code/launchpad2/node_modules/broccoli-filter/index.js:122:21)
at lib$rsvp$$internal$$tryCatch (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:505:17)
at /home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:1001:13
at lib$rsvp$asap$$flush (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:1198:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
The broccoli plugin was instantiated at:
at CoverageInstrumenter.Plugin (/home/lolmaus/Code/launchpad2/node_modules/broccoli-plugin/index.js:7:31)
at CoverageInstrumenter.Filter [as constructor] (/home/lolmaus/Code/launchpad2/node_modules/broccoli-filter/index.js:34:10)
at new CoverageInstrumenter (/home/lolmaus/Code/launchpad2/node_modules/ember-cli-code-coverage/lib/coverage-instrumenter.js:72:10)
at CoreObject.module.exports.preprocessTree (/home/lolmaus/Code/launchpad2/node_modules/ember-cli-code-coverage/index.js:52:28)
at /home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:584:41
at Array.reduce (native)
at EmberApp.addonPreprocessTree (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:583:30)
at EmberApp.appAndDependencies (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:1062:18)
at EmberApp.javascript (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:1199:34)
at EmberApp.toArray (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:1604:10)
at EmberApp.toTree (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/broccoli/ember-app.js:1626:30)
at module.exports (/home/lolmaus/Code/launchpad2/ember-cli-build.js:35:14)
at CoreObject.module.exports.Task.extend.setupBroccoliBuilder (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/models/builder.js:74:19)
at CoreObject.module.exports.Task.extend.init (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/models/builder.js:54:10)
at CoreObject.superWrapper [as init] (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/node_modules/core-object/lib/assign-properties.js:32:18)
at CoreObject.Class (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/node_modules/core-object/core-object.js:32:33)
at CoreObject.module.exports.Task.extend.run (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/tasks/build.js:15:19)
at CoreObject.<anonymous> (/home/lolmaus/Code/launchpad2/node_modules/ember-cli/lib/commands/test.js:164:27)
at lib$rsvp$$internal$$tryCatch (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:505:17)
at /home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:1001:13
at lib$rsvp$asap$$flush (/home/lolmaus/Code/launchpad2/node_modules/rsvp/dist/rsvp.js:1198:9)
When using ES6 in my project (also using ES7 decorators via ember-computed-decorators
), the code coverage being reported is against the transpiled ES5 code. In order to make the coverage report more useful when using services such as Coveralls or editor plugins such as lcov-info for Atom, the coverage should report against line numbers in the original source code.
I'm getting an error using decorators:
The Broccoli Plugin: [CoverageInstrumenter] failed with:
Error: Line 23: Unexpected token ILLEGAL
The line in question:
@equal('model.statusSort', IncidentConstants.incStatus.CLOSED) incidentIsClosed: null,
With the latest release (0.2.*) I see hbs
(compiled as js
) files taken into account for code coverage. Is that the expected behaviour?
It seems pretty odd that we would want to consider tests/dummy/app
files as part of code coverage (since they are actually part of the test harness itself).
Does anyone have objections?
/cc @sglanzer @kategengler @rwwagner90 @sandersky @kellyselden
Ember CLI supports a custom path for app's configuration via configPath
variable in package.json
. Project
model has configPath
method to aid.
I think it could be as easy as replacing config
to configPath
function call over here.
Scenario : We are trying to deploy a instrumented ember App on a internal server and run test using wdio test runner or any other test framework(Pytest). At the end of the test we will download the coverage result.
Our observation: What we have noticed that Unless we instrument and deploy the code on the same server where Istanbul middleware is running, we are not able to get the coverage information correctly. This is problematic when we have to run multipple different application.
Question: Is there any suggestion how to handle this scenario in a best possible way?
Is there an option to include files that are part of the app/
folder but haven't been executed when running tests?
Not doing so results in a wrong, overstated coverage score.
config/coverage-config.js
seems redundant, what do you think about changing the file to config/coverage.js
or config/code-coverage.js
?
[When running tests with COVERAGE=true, not generating results.
config/coverage.js has:
module.exports = {
reporters: ['lcov', 'html']
}
mirage/config.js has:
this.passthrough('/write-coverage');
(NOTE: When this was wrong, I got errors about ember not being able to POST to /write-coverage. Those errors are gone now)
I am running the tests like:
COVERAGE=true ember test
The tests run, but no results output. How can I triage this? Not sure where to go, because no errors are getting reported. (except a "Building(node) warning: possible EventEmitter memory leak detected. 11 exit listeners added." warning)
Hey @kategengler, I'm glad you finally released this addon π, and also glad to be the first to fill an issue π
When I run the tests I get the following error:
$ COVERAGE=true ember test
version: 1.13.13
Built project successfully. Stored in "/Users/benoror/workspace/nimbox/tmp/class-tests_dist-aYKI4ECy.tmp".
not ok 1 PhantomJS 2.1 - global failure
---
actual: >
null
message: >
TypeError: undefined is not a constructor (evaluating 'Testem.afterTests(function(config, data, callback) {
sendCoverage(callback);
})')
Log: |
...
...
I think it's due to global variable Testem
not being loaded: 65821e5#diff-94eab975fb48e219fc130d82e21457acR32
Maybe related to my build script not injecting Testem during tests? Or maybe because of the Ember or Testem version I'm using?
Thanks in advance and kudos for this!
Having now set up coverage for ember-ajax
, I'm trying to get it working right.
The follow are the files that are having coverage calculated:
However, I've tried to ignore the whole tests/dummy
directory with the configuration here. It seems like the files are not actually being ignored.
The current code that kicks off a require
for each module will only require addon files in addon/
directory. It does not include app/
files (since they would be under dummy
not my-addon-name
).
In conjunction with #71, we should also kick off require's for dummy
when in an addon.
Forgive me if this is a dumb question, but is there a way of viewing the generated coverage files from within Ember itself, or do I have to manually open those files on my computer from my web browser? As reference, I was using ember-cli-blanket
previously, and I had the option of viewing coverage details when navigating to http://localhost/tests?coverage
, which would run the tests and show coverage at the bottom. Does ember-cli-code-coverage
have a similar option?
Please ignore.ember-cli-code-coverage
now supports addons so I want to get that running for ember-ajax
.
Is this addon supporting integration components? Like for instance if I have an integration component test like the following one:
test('Should display number', function(assert) {
this.set('number', 1);
this.render(hbs`{{my-number number=number}}`);
assert.equal(this.$('.number-class').text(), 1, 'Number is displayed');
});
Will this addon know that the involved properties or methods of the component are involved in the test and take that into account when providing the coverage result? In that case can you shortly explain how that works?
Thanks!
Ember-engines allow use in-repo style of engine location, in this case testing results of main app includes testing results of engine. But code coverage output, unlike tap file, not includes coverage results for engine.
Steps to reproduce:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.