Skip to content

Untested files - #28

Closed
EWhite613 wants to merge 50 commits into
ember-cli-code-coverage:addon-spikefrom
EWhite613:untested-files
Closed

EWhite613 wants to merge 50 commits into
ember-cli-code-coverage:addon-spikefrom
EWhite613:untested-files

Conversation

@EWhite613

Copy link
Copy Markdown
Contributor

Require untested files.

Comment thread lib/templates/test-body-footer.html Outdated
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){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@mike183

mike183 commented Aug 31, 2016 •

Copy link
Copy Markdown

Just given your fork a try. From a glance, it appears to be working very well! Thank you! 👍

@rwjblue

rwjblue commented Oct 7, 2016

Copy link
Copy Markdown
Collaborator

Where are we with this?

@sglanzer - Can you take a peek?

rwjblue and others added 5 commits October 7, 2016 11:34
…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.
@sandersky

Copy link
Copy Markdown
Contributor

@EWhite613 I'd love to see more tests around all of the code this pull request adds.

nfc036 and others added 9 commits October 10, 2016 13:31
this.parent.name is a function (if defined), this.parent.pkg.name is the expected name of the package.
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
@sglanzer-fire

Copy link
Copy Markdown

@rwjblue @sandersky

Sorry, these comments got buried in my email, I'll take some time today to review

@sglanzer-fire sglanzer-fire left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.js Outdated
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 || [] });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to nitpick, but for readability can you put one prop per line?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwjblue is there a best practice way to pick up the app name? this.parent.pkg.name seems potentially brittle

Comment thread lib/attach-middleware.js
var path = require('path');
var fs = require('fs-extra');

var minimatch = require('minimatch')

@sglanzer-fire sglanzer-fire Oct 12, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we re-use the ember-cli glob dependency for this? It's using minimatch under the covers

Comment thread lib/attach-middleware.js Outdated
}),
function(req, res) {
var entries = req.body['entries[]'] || req.body.entries
debugger

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debugger

Comment thread lib/attach-middleware.js
}
return false
}
app.post('/filter-entries',bodyParser.urlencoded({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why post?

Comment thread lib/attach-middleware.js Outdated
return false
}
app.post('/filter-entries',bodyParser.urlencoded({
limit: '50mb',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be configurable

Comment thread lib/attach-middleware.js
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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you separate this into another PR?

}

function getModuleName (){
return jQuery.ajax({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ;)

Comment thread lib/templates/test-body-footer.html Outdated
}
if (typeof Testem !== "undefined" && Testem.afterTests) {
Testem.afterTests(function(config, data, callback) {
console.log('filtering entries')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either remove or use the ember-cli logger

Comment thread test/unit/index-test.js
});

describe('_doesFileExistInCurrentProject', function() {
describe('_doesFileExistInCurrentProjectApp', function() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the rename relevant to this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sglanzer-fire

Copy link
Copy Markdown

Addresses #20

@rwjblue

rwjblue commented Nov 1, 2016

Copy link
Copy Markdown
Collaborator

#62 landed basic support for #20. I believe that this PR may still be needed for more thorough support, but can y'all take a look?

@sglanzer-fire

Copy link
Copy Markdown

@rwjblue looking now

@sglanzer-fire

Copy link
Copy Markdown

@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)

@RobbieTheWagner

Copy link
Copy Markdown
Collaborator

@rwjblue @sglanzer I can help with porting anything that may still be desired from this PR, but AFAIK, we now have support for pulling in un-tested files.

@sglanzer-fire

Copy link
Copy Markdown

Close it up

@RobbieTheWagner

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants