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

Allow additional matchers to be added without monkey patching prototype. #14

Merged
merged 1 commit into from
Sep 11, 2015

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 10, 2015

Currently, TestLoader.prototype.shouldLoadModule is monkey patched by ember-cli-qunit / ember-cli-mocha to add their own custom rules for matching modules.

This change allows additional addons to add their own custom matchers (for example adding additional extension types) or to suppress a certain subset of modules (for example JSHint or JSCS tests).

@rwjblue
Copy link
Member Author

rwjblue commented Sep 10, 2015

Submitted ember-cli/ember-cli-qunit#77 to use this API.

@@ -53,9 +82,14 @@ define("ember-cli/test-loader",
new TestLoader().loadModules();
};

TestLoader.addModuleIncludeMatcher = addModuleIncludeMatcher;

Choose a reason for hiding this comment

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

I see you expose the add functions in 2 different ways by both adding them to the TestLoader function here, as well as returning the function directly in the return object below (90-91). I'm ok with it, but just curious why both were done.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just indecisiveness 😝

Choose a reason for hiding this comment

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

I guess adding it to TestLoader will save us a line of code on the other end, instead of setting the function to a separate variable off the module, we can just invoke it directly on TestLoader. (I'm talking about the other pull request: https://github.com/ember-cli/ember-cli-qunit/pull/77/files line 6 and 12-13). Not a big deal at all though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah, I went the other way. Modules 4 LYFE!

Choose a reason for hiding this comment

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

👍

Currently, `TestLoader.prototype.shouldLoadModule` is monkey patched by
ember-cli-qunit / ember-cli-mocha to add their own custom rules for
matching modules.

This change allows additional addons to add their own custom matchers
(for example adding additional extension types) or to suppress a certain
subset of modules (for example JSHint or JSCS tests).
@rwjblue rwjblue force-pushed the allow-additional-matchers branch from ba78280 to eecfbc1 Compare September 10, 2015 03:56
@toddjordan
Copy link

🚢shipit, thx for cranking this out

rwjblue added a commit that referenced this pull request Sep 11, 2015
Allow additional matchers to be added without monkey patching prototype.
@rwjblue rwjblue merged commit 683c3d8 into master Sep 11, 2015
@rwjblue rwjblue deleted the allow-additional-matchers branch September 11, 2015 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants