Repository navigation
Conversation
…e-patch-1 Add `includePolyfill` to removed babel options.
- Make errors more helpful when tests error in the future
Avoid requiring jQuery for sending the coverage report back.
…some random module
| var parts = moduleName.split('/') | ||
| try { | ||
| if (parts.length >= 1 && parts[0] === appName || parts.length >= 2 && parts[0] === 'dummy' && parts[1] === appName){ | ||
| if (!shouldExclude(moduleName).result){ |
There was a problem hiding this comment.
Can we flip this on its head: POST the result of Object.keys(requirejs.entries) and have the server return an array of modules to require?
|
Just given your fork a try. From a glance, it appears to be working very well! Thank you! 👍 |
…spike Support Addon Coverage
…stray-logging Remove stray console.log
Last try on this anchor business
|
Where are we with this? @sglanzer - Can you take a peek? |
…d-package-names Handle addons with different package names
Let the underlying subsystem deal with the `path.sep` differences, the logic here was incorrectly interchanging `\` and `/` on windows.
…ix-path-seps Use posix paths for dealing with modules.
|
@EWhite613 I'd love to see more tests around all of the code this pull request adds. |
this.parent.name is a function (if defined), this.parent.pkg.name is the expected name of the package.
Tests adjusted according to [ember-cli/lib/models/project.js](https://github.com/ember-cli/ember-cli/blob/1cae632e9724d0fc02cb91e90d83e70e78f75069/lib/models/project.js#L142).
return actual name not function from _parentName
Renamed `_doesFileExistIsCurrentProjectAddonModule` to `_doesFileExistInCurrentProjectAddonModule` and its parameter from `_relativePath` to `relativePath` to make is consistent with other `_doesFileExist...`-functions. Cosmetics only, no functional changes.
spaces removed that lead to a failing eslint test.
Cosmetics for docs, renamed function name and parameter name
|
Sorry, these comments got buried in my email, I'll take some time today to review |
sglanzer-fire
left a comment
There was a problem hiding this comment.
It's been a while since I looked at this type of code, so excuse me if I make some odd comments. I've flagged a couple areas that appear brittle and I'd like to have those addressed via comments if possible.
| testemMiddleware: function(app) { | ||
| if (!this._isCoverageEnabled()) { return; } | ||
| attachMiddleware(app, { root: this.project.root, ui: this.ui }); | ||
| attachMiddleware(app, { root: this.project.root, ui: this.ui, appName: this.parent.pkg.name, excludes: this._getConfig().excludes || [] }); |
There was a problem hiding this comment.
Sorry to nitpick, but for readability can you put one prop per line?
There was a problem hiding this comment.
@rwjblue is there a best practice way to pick up the app name? this.parent.pkg.name seems potentially brittle
| var path = require('path'); | ||
| var fs = require('fs-extra'); | ||
|
|
||
| var minimatch = require('minimatch') |
There was a problem hiding this comment.
Can we re-use the ember-cli glob dependency for this? It's using minimatch under the covers
| }), | ||
| function(req, res) { | ||
| var entries = req.body['entries[]'] || req.body.entries | ||
| debugger |
| } | ||
| return false | ||
| } | ||
| app.post('/filter-entries',bodyParser.urlencoded({ |
| return false | ||
| } | ||
| app.post('/filter-entries',bodyParser.urlencoded({ | ||
| limit: '50mb', |
There was a problem hiding this comment.
This should probably be configurable
| var result = false | ||
| if (typeof (seen[entry]) === 'undefined') { | ||
| var parts = entry.split('/') | ||
| if (parts.length >= 1 && parts[0] === appName || parts.length >= 2 && parts[0] === 'dummy' && parts[1] === appName) { |
There was a problem hiding this comment.
I'm wary of this - @rwjblue is this a predictable/consistent format that can be relied on?
| try { | ||
| return instrumenter.instrumentSync(content, relativePath); | ||
| } catch (e) { | ||
| console.error('Unable to cover:', relativePath, '. Try setting useBabelInstrumenter to true. \n', e.stack); |
There was a problem hiding this comment.
Can you separate this into another PR?
| } | ||
|
|
||
| function getModuleName (){ | ||
| return jQuery.ajax({ |
There was a problem hiding this comment.
I'd prefer not to rely directly on jQuery, if ember-cli includes an ajax lib let's use that - feel free to tell me that it's jQuery ;)
| } | ||
| if (typeof Testem !== "undefined" && Testem.afterTests) { | ||
| Testem.afterTests(function(config, data, callback) { | ||
| console.log('filtering entries') |
There was a problem hiding this comment.
Either remove or use the ember-cli logger
| }); | ||
|
|
||
| describe('_doesFileExistInCurrentProject', function() { | ||
| describe('_doesFileExistInCurrentProjectApp', function() { |
There was a problem hiding this comment.
Is the rename relevant to this PR?
There was a problem hiding this comment.
No. I think I might have snuck it in the previous as well. Since doesFileExistInCurrentProject1 was renamed to doesFileExistInCurrentProject -> doesFileExistInCurrentProjectApp but the tests weren't
|
Addresses #20 |
|
@rwjblue looking now |
|
@rwjblue this PR also includes filtering code (has this been addressed?), but the code related to covering un-tested files looks to be addressed in #62 I'm assuming https://github.com/kategengler/ember-cli-code-coverage/pull/62/files#diff-94eab975fb48e219fc130d82e21457acR6 will work the same for addon / app paths Anyhow, I'm good to close this and port code into a filter PR (if required) |
|
Close it up |
|
Going to close this, feel free to reopen if it is deemed we still want to try to merge. Otherwise, please advise of the parts we want to pull out of this, and I can help get them in. |
Require untested files.