Closed Bug 978622 Opened 10 years ago Closed 10 years ago

COVERAGE=1 does not work when requireApp is not immediately invoked

Categories

(Firefox OS Graveyard :: Gaia::TestAgent, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: kgrandon, Unassigned)

References

Details

Take the following pattern, which is very common in gaia, COVERAGE=1 does not display results for some of the files.

// Test file start
// This file works in coverage
requireApp('app/js/some_file.js');

suite('my suite', function() {
  setup(function(done) {
    // This file is *not* included in coverage results.
    requireApp('app/js/some_other_file.js');
  });
});
Blocks: 977574
Ricky - any interest in picking this up? If not - could you point to some source files of where one would look to fix this? Thanks!
Flags: needinfo?(ricky060709)
Yo, I'm working on it recently. 

Most of the coverage tool doesn't support lazy loading on browser side. Blanket.js cannot cover if we load files in this way.

I'm going to patch blanket.js. It will be a new feature and hope they can accept the patch. :)
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(ricky060709)
Resolution: --- → DUPLICATE
Reopening this because I'm still seeing this on master. When I run the command: COVERAGE=1 make test-agent-test APP=search

I only see the following results:

File Name - Covered/Total Smts - Coverage (%)

  http://search.gaiamobile.org:8080/js/eme/eme.js - 11/25 - 44 %
  http://search.gaiamobile.org:8080/js/providers/provider.js - 35/36 - 97.22 %
  http://search.gaiamobile.org:8080/js/providers/bgimage.js - 16/27 - 59.26 %

In reality, many more files are included in requireApp(), but only asynchronously in the setup. Ricky - any guess here? Can you show me the outpost when you run this command? Thanks!
Status: RESOLVED → REOPENED
Flags: needinfo?(ricky060709)
Resolution: DUPLICATE → ---
Oops! It really works on my mac / ubuntu regardless testing on Test Agent App or command line.
Did you try this feature by enabling in Test Agent App?
Flags: needinfo?(ricky060709)
I just found a weird situation that I carelessly use "make update-common" in gaia and it replaced my chai.js so that caused an incorrect result.

Or another cause might be somethings different in directories which were ignored by git such as node_modules.
So we can try to update node_modules :)
Thanks for checking Ricky! I will be in Taipei next week, so perhaps we can sit together for a bit and debug this.
Wow! so cool!

I'll go to office in Wed, Thu and Fri (My internship time), so we can discuss this problem at that time.

And I'm still improving my poor English now, so hope you can accept my speaking :)
(In reply to Ricky Chien [:rickychien] from comment #5)
> I just found a weird situation that I carelessly use "make update-common" in
> gaia and it replaced my chai.js so that caused an incorrect result.

Shouldn't this be fixed in some way?
Apparently this is invalid. Re-cloning gaia seems to have fixed this for me (but not running this after a make really-clean). No idea why, but we should be good for now. Thanks and sorry for the confusion here.
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.