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

[RFC 637] Customizable test setups #19981

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,6 @@
import { describe, it } from 'mocha';
import { expect } from 'chai';
import { setupApplicationTest } from 'ember-mocha';
import { setupApplicationTest } from '<%= dasherizedPackageName %>/tests/helpers';
import { visit, currentURL } from '@ember/test-helpers';

describe('<%= friendlyTestName %>', function () {
Expand Down
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from '<%= dasherizedPackageName %>/tests/helpers';

module('<%= friendlyTestName %>', function (hooks) {
setupApplicationTest(hooks);
Expand Down
@@ -1,6 +1,6 @@
<% if (testType === 'integration') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>

Expand All @@ -26,7 +26,7 @@ describe('<%= friendlyTestDescription %>', function () {
});
});<% } else if (testType === 'unit') { %>import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

describe('<%= friendlyTestDescription %>', function () {
setupTest();
Expand Down
@@ -1,5 +1,5 @@
<% if (testType === 'integration') { %>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>

Expand All @@ -24,7 +24,7 @@ module('<%= friendlyTestDescription %>', function (hooks) {
assert.dom(this.element).hasText('template block text');
});
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

module('<%= friendlyTestDescription %>', function (hooks) {
setupTest(hooks);
Expand Down
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

describe('<%= friendlyTestDescription %>', function () {
setupTest();
Expand Down
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

module('<%= friendlyTestDescription %>', function (hooks) {
setupTest(hooks);
Expand Down
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>

Expand Down
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from '<%= dasherizedPackageName %>/tests/helpers';
import { render } from '@ember/test-helpers';
<%= hbsImportStatement %>

Expand Down
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

describe('<%= friendlyTestDescription %>', function () {
setupTest();
Expand Down
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

module('<%= friendlyTestDescription %>', function (hooks) {
setupTest(hooks);
Expand Down
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

describe('<%= friendlyTestDescription %>', function () {
setupTest();
Expand Down
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from '<%= dasherizedPackageName %>/tests/helpers';

module('<%= friendlyTestDescription %>', function (hooks) {
setupTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/blueprints/acceptance-test-test.js
Expand Up @@ -139,7 +139,7 @@ describe('Blueprint: acceptance-test', function () {
it('acceptance-test foo', function () {
return emberGenerateDestroy(['acceptance-test', 'foo'], (_file) => {
expect(_file('tests/acceptance/foo-test.js')).to.equal(
fixture('acceptance-test/qunit-rfc268.js')
fixture('acceptance-test/qunit-rfc268-addon.js')
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/acceptance-test/mocha-rfc268.js
@@ -1,6 +1,6 @@
import { describe, it } from 'mocha';
import { expect } from 'chai';
import { setupApplicationTest } from 'ember-mocha';
import { setupApplicationTest } from 'my-app/tests/helpers';
import { visit, currentURL } from '@ember/test-helpers';

describe('Acceptance | foo', function () {
Expand Down
13 changes: 13 additions & 0 deletions node-tests/fixtures/acceptance-test/qunit-rfc268-addon.js
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'my-addon/tests/helpers';

module('Acceptance | foo', function (hooks) {
setupApplicationTest(hooks);

test('visiting /foo', async function (assert) {
await visit('/foo');

assert.strictEqual(currentURL(), '/foo');
});
});
2 changes: 1 addition & 1 deletion node-tests/fixtures/acceptance-test/qunit-rfc268.js
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'my-app/tests/helpers';

module('Acceptance | foo', function (hooks) {
setupApplicationTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha-rfc232-unit.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from 'my-app/tests/helpers';

describe('Unit | Component | x-foo', function () {
setupTest();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/mocha-rfc232.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { setupRenderingTest } from 'my-app/tests/helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/rfc232-unit.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app/tests/helpers';

module('Unit | Component | x-foo', function (hooks) {
setupTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/component-test/rfc232.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app/tests/helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/controller-test/mocha-rfc232-nested.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from 'my-app/tests/helpers';

describe('Unit | Controller | foo/bar', function () {
setupTest();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/controller-test/mocha-rfc232.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from 'my-app/tests/helpers';

describe('Unit | Controller | foo', function () {
setupTest();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/controller-test/rfc232-nested.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app/tests/helpers';

module('Unit | Controller | foo/bar', function (hooks) {
setupTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/controller-test/rfc232.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app/tests/helpers';

module('Unit | Controller | foo', function (hooks) {
setupTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/mocha-rfc232.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { setupRenderingTest } from 'my-app/tests/helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/helper-test/rfc232.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { setupRenderingTest } from 'my-app/tests/helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/route-test/mocha-rfc232.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from 'my-app/tests/helpers';

describe('Unit | Route | foo', function () {
setupTest();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/route-test/rfc232.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app/tests/helpers';

module('Unit | Route | foo', function (hooks) {
setupTest(hooks);
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/service-test/mocha-rfc232.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { setupTest } from 'ember-mocha';
import { setupTest } from 'my-app/tests/helpers';

describe('Unit | Service | foo', function () {
setupTest();
Expand Down
2 changes: 1 addition & 1 deletion node-tests/fixtures/service-test/rfc232.js
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { setupTest } from 'my-app/tests/helpers';

module('Unit | Service | foo', function (hooks) {
setupTest(hooks);
Expand Down