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

Commit e459028

Browse files
committed
Upgrade to ember-template-lint v2
1 parent 54d8832 commit e459028

3 files changed

Lines changed: 138 additions & 129 deletions

File tree

node-tests/acceptance/broccoli-test.js

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ describe('broccoli-template-linter', function() {
5050
expect(result.templates).to.have.property('application.template.lint-test.js');
5151

5252
let contents = result.templates['application.template.lint-test.js'];
53-
expect(contents).to.equal("QUnit.module('TemplateLint | templates/application.hbs');\nQUnit.test('should pass TemplateLint', function(assert) {\n assert.expect(1);\n assert.ok(false, 'templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 5:9 error Incorrect indentation for `div` beginning at L2:C0. Expected `</div>` ending at L5:C9 to be at an indentation of 0 but was found at 3. block-indentation\\n 4:5 error Incorrect indentation for `p` beginning at L3:C2. Expected `</p>` ending at L4:C5 to be at an indentation of 2 but was found at 1. block-indentation\\n 1:0 error HTML comment detected no-html-comments\\n');\n});\n");
53+
expect(contents).to.equal(`QUnit.module('TemplateLint | templates/application.hbs');
54+
QUnit.test('should pass TemplateLint', function(assert) {
55+
assert.expect(1);
56+
assert.ok(false, 'templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 1:0 error HTML comment detected no-html-comments\\n');
57+
});
58+
`);
5459
}));
5560

5661
it('generates a Mocha test file if "testGenerator: mocha" is provided', co.wrap(function *() {
@@ -69,7 +74,15 @@ describe('broccoli-template-linter', function() {
6974
expect(result.templates).to.have.property('application.template.lint-test.js');
7075

7176
let contents = result.templates['application.template.lint-test.js'];
72-
expect(contents).to.equal("describe('TemplateLint | templates/application.hbs', function() {\n it('should pass TemplateLint', function() {\n // test failed\n var error = new chai.AssertionError('templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 5:9 error Incorrect indentation for `div` beginning at L2:C0. Expected `</div>` ending at L5:C9 to be at an indentation of 0 but was found at 3. block-indentation\\n 4:5 error Incorrect indentation for `p` beginning at L3:C2. Expected `</p>` ending at L4:C5 to be at an indentation of 2 but was found at 1. block-indentation\\n 1:0 error HTML comment detected no-html-comments\\n');\n error.stack = undefined;\n throw error;\n });\n});\n");
77+
expect(contents).to.equal(`describe('TemplateLint | templates/application.hbs', function() {
78+
it('should pass TemplateLint', function() {
79+
// test failed
80+
var error = new chai.AssertionError('templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 1:0 error HTML comment detected no-html-comments\\n');
81+
error.stack = undefined;
82+
throw error;
83+
});
84+
});
85+
`);
7386
}));
7487

7588
it('generates a QUnit test file if "testGenerator: qunit" and "groupName: foo" are provided', co.wrap(function *() {
@@ -90,7 +103,14 @@ describe('broccoli-template-linter', function() {
90103
expect(result).to.have.property('foo.template.lint-test.js');
91104

92105
let contents = result['foo.template.lint-test.js'];
93-
expect(contents.trim()).to.equal("QUnit.module('TemplateLint | foo');\n\nQUnit.test('templates/application.hbs', function(assert) {\n assert.expect(1);\n assert.ok(false, 'templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 5:9 error Incorrect indentation for `div` beginning at L2:C0. Expected `</div>` ending at L5:C9 to be at an indentation of 0 but was found at 3. block-indentation\\n 4:5 error Incorrect indentation for `p` beginning at L3:C2. Expected `</p>` ending at L4:C5 to be at an indentation of 2 but was found at 1. block-indentation\\n 1:0 error HTML comment detected no-html-comments\\n');\n});");
106+
expect(contents).to.equal(`QUnit.module('TemplateLint | foo');
107+
108+
QUnit.test('templates/application.hbs', function(assert) {
109+
assert.expect(1);
110+
assert.ok(false, 'templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 1:0 error HTML comment detected no-html-comments\\n');
111+
});
112+
113+
`);
94114
}));
95115

96116
it('generates a Mocha test file if "testGenerator: mocha" and "groupName: foo" are provided', co.wrap(function *() {
@@ -109,7 +129,16 @@ describe('broccoli-template-linter', function() {
109129
expect(result).to.have.property('foo.template.lint-test.js');
110130

111131
let contents = result['foo.template.lint-test.js'];
112-
expect(contents.trim()).to.equal("describe('TemplateLint | foo', function() {\n\n it('templates/application.hbs', function() {\n // test failed\n var error = new chai.AssertionError('templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 5:9 error Incorrect indentation for `div` beginning at L2:C0. Expected `</div>` ending at L5:C9 to be at an indentation of 0 but was found at 3. block-indentation\\n 4:5 error Incorrect indentation for `p` beginning at L3:C2. Expected `</p>` ending at L4:C5 to be at an indentation of 2 but was found at 1. block-indentation\\n 1:0 error HTML comment detected no-html-comments\\n');\n error.stack = undefined;\n throw error;\n });\n\n});");
132+
expect(contents.trim()).to.equal(`describe('TemplateLint | foo', function() {
133+
134+
it('templates/application.hbs', function() {
135+
// test failed
136+
var error = new chai.AssertionError('templates/application.hbs should pass TemplateLint.\\n\\ntemplates/application.hbs\\n 1:0 error HTML comment detected no-html-comments\\n');
137+
error.stack = undefined;
138+
throw error;
139+
});
140+
141+
});`);
113142
}));
114143

115144
it('generates empty test files if no "generateTestFile" option is provided', co.wrap(function *() {
@@ -143,8 +172,6 @@ describe('broccoli-template-linter', function() {
143172

144173
let combinedLog = mockConsole._logLines.join('\n');
145174

146-
expect(combinedLog).to.contain('Incorrect indentation for `div`');
147-
expect(combinedLog).to.contain('Incorrect indentation for `p`');
148175
expect(combinedLog).to.contain('HTML comment detected');
149176
}));
150177

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"chalk": "^3.0.0",
3737
"debug": "^4.0.1",
3838
"ember-cli-version-checker": "^3.0.1",
39-
"ember-template-lint": "^1.2.0",
39+
"ember-template-lint": "^2.0.0-beta.5",
4040
"json-stable-stringify": "^1.0.1",
4141
"md5-hex": "^3.0.1",
4242
"strip-ansi": "^6.0.0",

0 commit comments

Comments
 (0)