Skip to content

Commit

Permalink
馃 Merge PR #62073 ember-qunit: export SetupTestOptions by @chriskrycho
Browse files Browse the repository at this point in the history


* ember-qunit: make SetupTestOptions public

This unblocks ember-cli/ember-cli#9972.

* ember-qunit: document that SetupTestOptions is internal

* ember-qunit: SetupTestOptions is *not* internal!

* ember-qunit: only change ember-qunit, not other Ember stuff
  • Loading branch information
chriskrycho committed Sep 1, 2022
1 parent 7143245 commit 876b874
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
23 changes: 22 additions & 1 deletion types/ember-qunit/ember-qunit-tests.ts
Expand Up @@ -9,6 +9,8 @@ import {
setResolver,
setupRenderingTest,
setupTest,
SetupTestOptions,
setupApplicationTest,
} from 'ember-qunit';
import { render, TestContext } from '@ember/test-helpers';
import EmberResolver from 'ember-resolver';
Expand Down Expand Up @@ -65,7 +67,7 @@ module('rendering', function (hooks) {
});

module('misc and async', function (hooks) {
hooks.beforeEach(async function(assert) {
hooks.beforeEach(async function (assert) {
assert.ok(true, 'hooks can be async');
});

Expand Down Expand Up @@ -294,3 +296,22 @@ module('extending TestContext works', function () {
});

start();

module('with setup options', function (hooks) {
// $ExpectType SetupTestOptions | undefined
type SetupTestOptions = Parameters<typeof setupTest>[1];
// $ExpectType SetupTestOptions | undefined
type SetupRenderingTestOptions = Parameters<typeof setupRenderingTest>[1];
// $ExpectType SetupTestOptions | undefined
type SetupApplicationTestOptions = Parameters<typeof setupApplicationTest>[1];

const resolver = EmberResolver.create();

setupTest(hooks, {});
setupRenderingTest(hooks, {});
setupApplicationTest(hooks, {});

setupTest(hooks, { resolver });
setupRenderingTest(hooks, { resolver });
setupApplicationTest(hooks, { resolver });
});
7 changes: 6 additions & 1 deletion types/ember-qunit/index.d.ts
Expand Up @@ -15,7 +15,12 @@ import { TestContext } from '@ember/test-helpers';
*/
export function setResolver(resolver: EmberResolver): void;

interface SetupTestOptions {
/**
* Options for configuring the test runner. Normally, you will not need to
* customize this. It is exported primarily so that end user app code can name
* it when passing it back to the framework.
*/
export interface SetupTestOptions {
/**
* The resolver to use when instantiating container-managed entities in the test.
*/
Expand Down

0 comments on commit 876b874

Please sign in to comment.