Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] HTML mode: QUnit.config.noglobals with coverage enabled #223

Merged
merged 2 commits into from
Aug 24, 2020

Conversation

matz3
Copy link
Member

@matz3 matz3 commented Aug 20, 2020

Code instrumented by istanbul introduces global variables
(cov_* for each file and a global __coverage__ variable).
This causes a failure when the "noglobals" QUnit config is active and
some file is loaded during a test as this pollutes the global namespace.

Hooking into the "after" function allows to add those variables to the
list of known globals so that they won't be detected as new globals.

Code instrumented by istanbul introduces global variables
(cov_* for each file and a global __coverage__ variable).
This causes a failure when the "noglobals" QUnit config is active and
some file is loaded during a test as this pollutes the global namespace.

Hooking into the "after" function allows to add those variables to the
list of known globals so that they won't be detected as new globals.
@matz3 matz3 added the bug Something isn't working label Aug 20, 2020
@matz3 matz3 requested a review from codeworrior August 20, 2020 12:43
Copy link
Member

@codeworrior codeworrior left a comment

Choose a reason for hiding this comment

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

LGTM. It took me a while to understand, how the test works:

  • it wasn't obvious to me that coverage is active in the test
  • it wasn't obvious to me whether test/app/foo will be instrumented or not
    (because the 'test' folder is excluded from instrumentation - one has to know the difference
    between folder names and module IDs and how both are used in the app)

Well, but the test covers what has been changed, so it's okay.


QUnit.start();
QUnit.test("Karma", function(assert) {
assert.ok(parent.__karma__.files["/base/webapp/.dotfile"], "Karma files should contain dotfiles");
Copy link
Member

Choose a reason for hiding this comment

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

How is this related to the change?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not. The test has been there before.

@matz3 matz3 merged commit 3764e9f into master Aug 24, 2020
@matz3 matz3 deleted the fix-qunit-noglobals-coverage branch August 24, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants