Skip to content

Commit

Permalink
Merge pull request #16160 from Turbo87/test-names
Browse files Browse the repository at this point in the history
[BUGFIX beta] Remove humanize() call from generated test descriptions
  • Loading branch information
rwjblue authored Jan 21, 2018
2 parents f2c2fb9 + 7037968 commit f9e1523
Show file tree
Hide file tree
Showing 29 changed files with 35 additions and 44 deletions.
5 changes: 3 additions & 2 deletions blueprints/acceptance-test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const path = require('path');
const testInfo = require('ember-cli-test-info');
const pathUtil = require('ember-cli-path-utils');
const stringUtils = require('ember-cli-string-utils');
const existsSync = require('exists-sync');
Expand All @@ -21,9 +20,11 @@ module.exports = useTestFrameworkDetector({
let destroyAppExists =
existsSync(path.join(this.project.root, '/tests/helpers/destroy-app.js'));

let friendlyTestName = ['Acceptance', stringUtils.dasherize(options.entity.name).replace(/[-]/g,' ')].join(' | ');

return {
testFolderRoot: testFolderRoot,
friendlyTestName: testInfo.name(options.entity.name, 'Acceptance', null),
friendlyTestName,
destroyAppExists: destroyAppExists
};
}
Expand Down
12 changes: 6 additions & 6 deletions blueprints/component-test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const path = require('path');
const testInfo = require('ember-cli-test-info');
const stringUtil = require('ember-cli-string-utils');
const isPackageMissing = require('ember-cli-is-package-missing');
const getPathOption = require('ember-cli-get-component-path-option');
Expand Down Expand Up @@ -42,16 +41,17 @@ module.exports = useTestFrameworkDetector({
let dasherizedModuleName = stringUtil.dasherize(options.entity.name);
let componentPathName = dasherizedModuleName;
let testType = options.testType || 'integration';
let friendlyTestDescription = testInfo.description(options.entity.name, 'Integration', 'Component');

let friendlyTestDescription = [
testType === 'unit' ? 'Unit' : 'Integration',
'Component',
dasherizedModuleName,
].join(' | ');

if (options.pod && options.path !== 'components' && options.path !== '') {
componentPathName = [options.path, dasherizedModuleName].filter(Boolean).join('/');
}

if (options.testType === 'unit') {
friendlyTestDescription = testInfo.description(options.entity.name, 'Unit', 'Component');
}

return {
path: getPathOption(options),
testType: testType,
Expand Down
3 changes: 1 addition & 2 deletions blueprints/controller-test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const stringUtil = require('ember-cli-string-utils');
const testInfo = require('ember-cli-test-info');

const useTestFrameworkDetector = require('../test-framework-detector');

Expand All @@ -12,7 +11,7 @@ module.exports = useTestFrameworkDetector({
let controllerPathName = dasherizedModuleName;
return {
controllerPathName: controllerPathName,
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Controller')
friendlyTestDescription: ['Unit', 'Controller', dasherizedModuleName].join(' | ')
};
}
});
3 changes: 1 addition & 2 deletions blueprints/helper-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const stringUtils = require('ember-cli-string-utils');
const isPackageMissing = require('ember-cli-is-package-missing');

Expand Down Expand Up @@ -34,7 +33,7 @@ module.exports = useTestFrameworkDetector({
locals: function(options) {
let testType = options.testType || 'integration';
let testName = testType === 'integration' ? 'Integration' : 'Unit';
let friendlyTestName = testInfo.name(options.entity.name, testName, 'Helper');
let friendlyTestName = [testName, 'Helper', options.entity.name].join(' | ');

return {
friendlyTestName: friendlyTestName,
Expand Down
3 changes: 1 addition & 2 deletions blueprints/initializer-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const stringUtils = require('ember-cli-string-utils');

const useTestFrameworkDetector = require('../test-framework-detector');
Expand All @@ -9,7 +8,7 @@ module.exports = useTestFrameworkDetector({
description: 'Generates an initializer unit test.',
locals: function(options) {
return {
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Initializer'),
friendlyTestName: ['Unit', 'Initializer', options.entity.name].join(' | '),
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix)
};
}
Expand Down
3 changes: 1 addition & 2 deletions blueprints/instance-initializer-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const stringUtils = require('ember-cli-string-utils');

const useTestFrameworkDetector = require('../test-framework-detector');
Expand All @@ -9,7 +8,7 @@ module.exports = useTestFrameworkDetector({
description: 'Generates an instance initializer unit test.',
locals: function(options) {
return {
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Instance Initializer'),
friendlyTestName: ['Unit', 'Instance Initializer', options.entity.name].join(' | '),
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix)
};
}
Expand Down
3 changes: 1 addition & 2 deletions blueprints/mixin-test/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const useTestFrameworkDetector = require('../test-framework-detector');

module.exports = useTestFrameworkDetector({
description: 'Generates a mixin unit test.',
locals: function(options) {
return {
projectName: options.inRepoAddon ? options.inRepoAddon : options.project.name(),
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Mixin')
friendlyTestName: ['Unit', 'Mixin', options.entity.name].join(' | ')
};
}
});
3 changes: 1 addition & 2 deletions blueprints/route-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const path = require('path');
const stringUtil = require('ember-cli-string-utils');
const useTestFrameworkDetector = require('../test-framework-detector');
Expand Down Expand Up @@ -43,7 +42,7 @@ module.exports = useTestFrameworkDetector({
}

return {
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Route'),
friendlyTestDescription: ['Unit', 'Route', options.entity.name].join(' | '),
moduleName: stringUtil.dasherize(moduleName)
};
},
Expand Down
4 changes: 1 addition & 3 deletions blueprints/service-test/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use strict';

const testInfo = require('ember-cli-test-info');

const useTestFrameworkDetector = require('../test-framework-detector');

module.exports = useTestFrameworkDetector({
description: 'Generates a service unit test.',
locals: function(options) {
return {
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Service')
friendlyTestDescription: ['Unit', 'Service', options.entity.name].join(' | ')
};
},
});
3 changes: 1 addition & 2 deletions blueprints/util-test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const testInfo = require('ember-cli-test-info');
const stringUtils = require('ember-cli-string-utils');

const useTestFrameworkDetector = require('../test-framework-detector');
Expand All @@ -9,7 +8,7 @@ module.exports = useTestFrameworkDetector({
description: 'Generates a util unit test.',
locals: function(options) {
return {
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Utility'),
friendlyTestName: ['Unit', 'Utility', options.entity.name].join(' | '),
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix)
};
}
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('x-foo', 'Integration | Component | x foo', {
moduleForComponent('x-foo', 'Integration | Component | x-foo', {
integration: true
});

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha-0.12-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupComponentTest } from 'ember-mocha';

describe('Unit | Component | x foo', function() {
describe('Unit | Component | x-foo', function() {
setupComponentTest('x-foo', {
// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha-0.12.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it } from 'mocha';
import { setupComponentTest } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';

describe('Integration | Component | x foo', function() {
describe('Integration | Component | x-foo', function() {
setupComponentTest('x-foo', {
integration: true
});
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha-unit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { describeComponent, it } from 'ember-mocha';

describeComponent('x-foo', 'Unit | Component | x foo',
describeComponent('x-foo', 'Unit | Component | x-foo',
{
// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { describeComponent, it } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';

describeComponent('x-foo', 'Integration | Component | x foo',
describeComponent('x-foo', 'Integration | Component | x-foo',
{
integration: true
},
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/rfc232-unit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Component | x foo', function(hooks) {
module('Unit | Component | x-foo', function(hooks) {
setupTest(hooks);

test('it exists', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/rfc232.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | x foo', function(hooks) {
module('Integration | Component | x-foo', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/unit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { moduleForComponent, test } from 'ember-qunit';

moduleForComponent('x-foo', 'Unit | Component | x foo', {
moduleForComponent('x-foo', 'Unit | Component | x-foo', {
// Specify the other units that are required for this test
// needs: ['component:foo', 'helper:bar'],
unit: true
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/mocha-0.12-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';
import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';

describe('Unit | Helper | foo/bar baz', function() {
describe('Unit | Helper | foo/bar-baz', function() {

// Replace this with your real tests.
it('works', function() {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/mocha-0.12.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it } from 'mocha';
import { setupComponentTest } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';

describe('Integration | Helper | foo/bar baz', function() {
describe('Integration | Helper | foo/bar-baz', function() {
setupComponentTest('foo/bar-baz', {
integration: true
});
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/mocha-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';
import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';

describe('Unit | Helper | foo/bar baz', function() {
describe('Unit | Helper | foo/bar-baz', function() {

// Replace this with your real tests.
it('works', function() {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/rfc232-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('Unit | Helper | foo/bar baz', function(hooks) {
module('Unit | Helper | foo/bar-baz', function(hooks) {
setupTest(hooks);

// Replace this with your real tests.
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/rfc232.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Helper | foo/bar baz', function(hooks) {
module('Integration | Helper | foo/bar-baz', function(hooks) {
setupRenderingTest(hooks);

// Replace this with your real tests.
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { fooBarBaz } from 'my-app/helpers/foo/bar-baz';
import { module, test } from 'qunit';

module('Unit | Helper | foo/bar baz');
module('Unit | Helper | foo/bar-baz');

// Replace this with your real tests.
test('it works', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/util-test/default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fooBar from 'my-app/utils/foo-bar';
import { module, test } from 'qunit';

module('Unit | Utility | foo bar');
module('Unit | Utility | foo-bar');

// Replace this with your real tests.
test('it works', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/util-test/dummy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fooBar from 'dummy/utils/foo-bar';
import { module, test } from 'qunit';

module('Unit | Utility | foo bar');
module('Unit | Utility | foo-bar');

// Replace this with your real tests.
test('it works', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/util-test/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import { describe, it } from 'mocha';
import fooBar from 'my-app/utils/foo-bar';

describe('Unit | Utility | foo bar', function() {
describe('Unit | Utility | foo-bar', function() {
// Replace this with your real tests.
it('works', function() {
let result = fooBar();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/util-test/rfc232.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fooBar from 'my-app/utils/foo-bar';
import { module, test } from 'qunit';

module('Unit | Utility | foo bar', function(hooks) {
module('Unit | Utility | foo-bar', function(hooks) {

// Replace this with your real tests.
test('it works', function(assert) {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"ember-cli-normalize-entity-name": "^1.0.0",
"ember-cli-path-utils": "^1.0.0",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-test-info": "^1.0.0",
"ember-cli-valid-component-name": "^1.0.0",
"ember-cli-version-checker": "^2.1.0",
"ember-router-generator": "^1.2.3",
Expand Down

0 comments on commit f9e1523

Please sign in to comment.