Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Add test module grouping by default #243

Merged
merged 7 commits into from
May 18, 2017
Merged

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented May 8, 2017

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Overall, 👍 . Left some clarifying questions inline though...

].join('\n'));
}));

it('generates a QUnit test file if "testGenerator: qunit" and "group: foo" are provided', co.wrap(function *() {
Copy link
Member

Choose a reason for hiding this comment

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

Just to be clear, it isn't possible for an end user to do this. That is intentional right?

Copy link
Member Author

Choose a reason for hiding this comment

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

as an end user you can only group: true/false and manually override the testGenerator option, but the defaults should work fine for everyone. this is similar to what we have in ember-cli-eslint now.

}]
);
let output = '';
if (this._testGenerator) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we properly support this anyways? If you have a project today without ember-cli-qunit or ember-cli-mocha (prior to this PR) what happens? What happens after this 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.

If you have a project today without ember-cli-qunit or ember-cli-mocha (prior to this PR) what happens?

Ember CLI will display a warning that you should install a test framework (for every generated test 😞) and it will generate an empty file

What happens after this change?

ember-cli-template-lint will display a warning that it couldn't detect a test framework (once) and it will generate an empty file

);
let output = '';
if (this._testGenerator) {
if (this.options.group) {
Copy link
Member

Choose a reason for hiding this comment

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

This is for explicitly opting out via group :false?

Copy link
Member Author

Choose a reason for hiding this comment

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

correct

output = [
this._testGenerator.suiteHeader(`TemplateLint | ${relativePath}`),
this._testGenerator.test('should pass TemplateLint', passed,
`${relativePath} should pass TemplateLint.\n\n${errorDisplay}`),
Copy link
Member

Choose a reason for hiding this comment

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

the errorDisplay is escaped by aot-test-generators?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, aot-test-generators handles all escaping now, and actually with far less bugs than js-escape-string did before...

index.js Outdated
annotation: 'TemplateLinter',
templatercPath: this.project.root + '/.template-lintrc',
generateTestFile: this.project.generateTestFile,
testGenerator: this._options.testGenerator,
group: (this._options.group !== false) ? type : undefined,
Copy link
Member

Choose a reason for hiding this comment

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

This makes it only possible for end users of ember-cli-template-lint to disable grouping, not to add a custom group. Is that intended? Based on one of the tests, it seemed that you did mean to allow this to be specified as a string...

Copy link
Member Author

Choose a reason for hiding this comment

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

there is a difference between the group option of the broccoli plugin and the group option of the Ember CLI addon. the former accepts a string to name the group, the latter only accepts a boolean to enable/disable grouping in general.

Copy link
Member

Choose a reason for hiding this comment

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

I don't find it valuable to have two concepts for the same word here. The broccoli plugin only exists to support the addon....

Copy link
Member

Choose a reason for hiding this comment

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

In other words, we should make both allow strings or both only care about booleans.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, they have different meanings though. the CLI addons is only configured once, while the broccoli plugin could potentially run for multiple lint trees. in ESLint that results in ESLint | app, ESLint | tests, and for some even ESLint | mirage, and the same might be true here although from initial testing it seems that TemplateLint | templates is the majority of it

Copy link
Member Author

Choose a reason for hiding this comment

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

@rwjblue I've renamed the option in the Broccoli plugin to groupName to better reflect that they expect different types. I'm also excluding the groupName from the test suite name if it equals templates which seems to be the default in most Ember projects.

@rwjblue
Copy link
Member

rwjblue commented May 17, 2017

looks like CI failures are related to changes here

@Turbo87
Copy link
Member Author

Turbo87 commented May 17, 2017

@rwjblue forgot to adjust the test code to the new option name 🙈

should be 🍏 now...

@rwjblue rwjblue merged commit 35a33b6 into ember-template-lint:master May 18, 2017
@Turbo87 Turbo87 deleted the aot branch May 18, 2017 21:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants