Skip to content

Does not include untested files #20

Closed

Description

@lolmaus

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.

Activity

  1. rwjblue commented on Jun 30, 2016

    @rwjblue
    Collaborator

    Interesting. This is likely a result of the modules being lazily resolved, so if you do not import a given module or force to evaluate it (via visiting a route or invoking a component) it wouldn't be reported.

    @sandersky / @kategengler / @sglanzer - Can one of y'all confirm this? I can add a thing that basically requires all app files (to ensure they are being evaluated) if that is the case...

  2. sglanzer-fire commented on Jun 30, 2016

    @sglanzer-fire

    @rwjblue yeah, that's what we did in blanket (required everything in the app directory)

  3. wagenet commented on Jul 1, 2016

    @wagenet
    Contributor

    I'd be happy to give this a shot.

  4. adhamhf commented on Jul 21, 2016

    @adhamhf

    Is there a work around to get all files tested until a new release happens?

    Also, would this also include .hbs files? I'm noting their is logic them that is not necessarily getting covered....

  5. sglanzer-fire commented on Jul 25, 2016

    @sglanzer-fire

    Coverage typically would include .hbs files, but the mapping is based on compiled templates (HTMLbars), so it doesn't always look pretty ;)

  6. sglanzer-fire commented on Jul 25, 2016

    @sglanzer-fire

    @wagenet did you get anywhere on this? I have a few devs that are going to start picking up the work around addon testing and we could take a look at this as well

  7. wagenet commented on Jul 27, 2016

    @wagenet
    Contributor

    @sglanzer didn't end up getting beyond a hack in my own app.

  8. wagenet commented on Jul 28, 2016

    @wagenet
    Contributor

    I added the following to my tests/index.html after the <script src="assets/test-loader.js"></script> line.

        <script>
          Testem.afterTests(function() {
            if (window.__coverage__) {
              Object.keys(require.entries).forEach(function(file) {
                // Only load non-test files from our app
                var parts = file.split('/');
                if (parts[0] === 'direwolf' && parts[1] !== 'tests') {
                  try {
                    require(file);
                  } catch(e) {
                    throw 'error requiring file for coverage: '+file;
                  }
                }
              });
            }
          });
        </script>

    (direwolf is the app's name.)

  9. sglanzer-fire commented on Jul 28, 2016

    @sglanzer-fire

    @EWhite613 is going to start picking up some of this work - pinging him here to start involvement

    Also @wagenet wins the app name of the month - I would want to work on a project with a name like that 👍

  10. fotinakis commented on Aug 8, 2016

    @fotinakis

    Happy to beta test this when ready — I just switched a large Ember app from ember-cli-blanket to this addon, coverage jumped from 55% to 85% due to this issue.

  11. benoror commented on Aug 9, 2016

    @benoror
    Contributor

    +1 same here

    On Mon, Aug 8, 2016, 18:15 Mike Fotinakis notifications@github.com wrote:

    Happy to beta test this when ready — I just switched a large Ember app
    from ember-cli-blanket to this addon, coverage jumped from 55% to 85% due
    to this issue.

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly, view it on GitHub
    #20 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AAHRTW6SgUEo3gMdYtsAjfQGOTPJ3f_Hks5qd7iugaJpZM4JCJZS
    .

    _Ben Orozco_Website: benoror.com
    Appointments: vyte.in/benoror

  12. EWhite613 commented on Aug 10, 2016

    @EWhite613
    Contributor

    I got to the point where I basically store file patterns in config/coverage.js and would read in the files, but was never able to produce a coverage object (Istanbul's api documentation leaves something to be desired)so I could add it to the coverage report.

    My only working solution was to merge the untested broccoli trees in, but I wasn't happy with that approach.

  13. mike183 commented on Aug 12, 2016

    @mike183

    I'm also running into this issue, I currently have an application with 0 tests (I know...terrible), but it's reporting back as 100% code coverage! 😅

  14. fotinakis commented on Aug 12, 2016

    @fotinakis
  15. sglanzer-fire commented on Aug 12, 2016

    @sglanzer-fire

    We're funky like that - just not sure if those concepts carry forward into the best practice version of a code coverage addon - someone else will need to make that call, my brain hasn't been in this space for a while

  16. fotinakis commented on Aug 12, 2016

    @fotinakis

    👍 I like it, I'm up for anything that fixes this. :)

  17. wagenet commented on Aug 12, 2016

    @wagenet
    Contributor

    @sglanzer it's the code name for https://www.skylight.io :)

  18. sglanzer-fire commented on Aug 13, 2016

    @sglanzer-fire

    I'll try to find some time next week to sync with @rwjblue and @kategengler - probably should put together a roadmap for this and the addon coverage issues

  19. lolmaus commented on Nov 1, 2016

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions