diff --git a/README.md b/README.md index 4d8cd1055..68ab5dde2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ember-test-helpers [![Build Status](https://secure.travis-ci.org/emberjs/ember-test-helpers.png?branch=master)](http://travis-ci.org/emberjs/ember-test-helpers) +# @ember/test-helpers [![Build Status](https://secure.travis-ci.org/emberjs/ember-test-helpers.png?branch=master)](http://travis-ci.org/emberjs/ember-test-helpers) A test-framework-agnostic set of helpers for testing Ember.js applications. @@ -15,9 +15,12 @@ standard Ember testing experience to any testing framework. A quick summary of the exports from the `ember-test-helpers` module: -* `setResolver` - This function is used to allow the other functions build a valid - container/registry that is able to look objects up from your application (just as a running Ember - application would). +* `setApplication` - This function is used to allow the rest of the setup + functions to build a valid container/registry which can be used to lookup + instances and factories from your application. +* `setResolver` - When `setApplication` has not been ran, this function is used to allow the other + functions build a valid container/registry that is able to look objects up + from your application (just as a running Ember application would). * `setContext` - Invoked by the host testing framework to set the current testing context (generally the `this` within a running test). * `getContext` - Used to retrieve the current testing context. diff --git a/addon-test-support/application.js b/addon-test-support/@ember/test-helpers/application.js similarity index 100% rename from addon-test-support/application.js rename to addon-test-support/@ember/test-helpers/application.js diff --git a/addon-test-support/build-owner.js b/addon-test-support/@ember/test-helpers/build-owner.js similarity index 84% rename from addon-test-support/build-owner.js rename to addon-test-support/@ember/test-helpers/build-owner.js index 0a07d2e73..1c4181882 100644 --- a/addon-test-support/build-owner.js +++ b/addon-test-support/@ember/test-helpers/build-owner.js @@ -1,6 +1,6 @@ import { Promise } from 'rsvp'; -import legacyBuildRegistry from './legacy-0-6-x/build-registry'; +import legacyBuildRegistry from 'ember-test-helpers/legacy-0-6-x/build-registry'; export default function({ application, resolver }) { if (application) { diff --git a/addon-test-support/ext/rsvp.js b/addon-test-support/@ember/test-helpers/ext/rsvp.js similarity index 100% rename from addon-test-support/ext/rsvp.js rename to addon-test-support/@ember/test-helpers/ext/rsvp.js diff --git a/addon-test-support/global.js b/addon-test-support/@ember/test-helpers/global.js similarity index 100% rename from addon-test-support/global.js rename to addon-test-support/@ember/test-helpers/global.js diff --git a/addon-test-support/has-ember-version.js b/addon-test-support/@ember/test-helpers/has-ember-version.js similarity index 100% rename from addon-test-support/has-ember-version.js rename to addon-test-support/@ember/test-helpers/has-ember-version.js diff --git a/addon-test-support/index.js b/addon-test-support/@ember/test-helpers/index.js similarity index 52% rename from addon-test-support/index.js rename to addon-test-support/@ember/test-helpers/index.js index f05a049a2..0499134b6 100644 --- a/addon-test-support/index.js +++ b/addon-test-support/@ember/test-helpers/index.js @@ -1,10 +1,4 @@ -// TODO: deprecate these once new API is rolled out -export { default as TestModule } from './legacy-0-6-x/test-module'; -export { default as TestModuleForAcceptance } from './legacy-0-6-x/test-module-for-acceptance'; -export { default as TestModuleForComponent } from './legacy-0-6-x/test-module-for-component'; -export { default as TestModuleForModel } from './legacy-0-6-x/test-module-for-model'; - -export { setResolver } from './resolver'; +export { setResolver, getResolver } from './resolver'; export { setApplication } from './application'; export { default as setupContext, diff --git a/addon-test-support/resolver.js b/addon-test-support/@ember/test-helpers/resolver.js similarity index 100% rename from addon-test-support/resolver.js rename to addon-test-support/@ember/test-helpers/resolver.js diff --git a/addon-test-support/settled.js b/addon-test-support/@ember/test-helpers/settled.js similarity index 100% rename from addon-test-support/settled.js rename to addon-test-support/@ember/test-helpers/settled.js diff --git a/addon-test-support/setup-context.js b/addon-test-support/@ember/test-helpers/setup-context.js similarity index 100% rename from addon-test-support/setup-context.js rename to addon-test-support/@ember/test-helpers/setup-context.js diff --git a/addon-test-support/setup-rendering-context.js b/addon-test-support/@ember/test-helpers/setup-rendering-context.js similarity index 100% rename from addon-test-support/setup-rendering-context.js rename to addon-test-support/@ember/test-helpers/setup-rendering-context.js diff --git a/addon-test-support/teardown-context.js b/addon-test-support/@ember/test-helpers/teardown-context.js similarity index 100% rename from addon-test-support/teardown-context.js rename to addon-test-support/@ember/test-helpers/teardown-context.js diff --git a/addon-test-support/teardown-rendering-context.js b/addon-test-support/@ember/test-helpers/teardown-rendering-context.js similarity index 100% rename from addon-test-support/teardown-rendering-context.js rename to addon-test-support/@ember/test-helpers/teardown-rendering-context.js diff --git a/addon-test-support/ember-test-helpers/has-ember-version.js b/addon-test-support/ember-test-helpers/has-ember-version.js new file mode 100644 index 000000000..0675ee934 --- /dev/null +++ b/addon-test-support/ember-test-helpers/has-ember-version.js @@ -0,0 +1 @@ +export { default } from '@ember/test-helpers/has-ember-version'; diff --git a/addon-test-support/ember-test-helpers/index.js b/addon-test-support/ember-test-helpers/index.js new file mode 100644 index 000000000..538dbb46c --- /dev/null +++ b/addon-test-support/ember-test-helpers/index.js @@ -0,0 +1,7 @@ +export * from '@ember/test-helpers'; + +// TODO: deprecate these once new API is rolled out +export { default as TestModule } from './legacy-0-6-x/test-module'; +export { default as TestModuleForAcceptance } from './legacy-0-6-x/test-module-for-acceptance'; +export { default as TestModuleForComponent } from './legacy-0-6-x/test-module-for-component'; +export { default as TestModuleForModel } from './legacy-0-6-x/test-module-for-model'; diff --git a/addon-test-support/legacy-0-6-x/-legacy-overrides.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/-legacy-overrides.js similarity index 100% rename from addon-test-support/legacy-0-6-x/-legacy-overrides.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/-legacy-overrides.js diff --git a/addon-test-support/legacy-0-6-x/abstract-test-module.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/abstract-test-module.js similarity index 96% rename from addon-test-support/legacy-0-6-x/abstract-test-module.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/abstract-test-module.js index 38a2ff4db..7274f66f3 100644 --- a/addon-test-support/legacy-0-6-x/abstract-test-module.js +++ b/addon-test-support/ember-test-helpers/legacy-0-6-x/abstract-test-module.js @@ -1,9 +1,9 @@ import { run } from '@ember/runloop'; import { Promise as EmberPromise, resolve } from 'rsvp'; import { assign, merge as emberMerge } from '@ember/polyfills'; -import { _setupPromiseListeners, _teardownPromiseListeners } from '../ext/rsvp'; -import { _setupAJAXHooks, _teardownAJAXHooks } from '../settled'; -import { getContext, setContext, unsetContext } from '../setup-context'; +import { _setupPromiseListeners, _teardownPromiseListeners } from '@ember/test-helpers/ext/rsvp'; +import { _setupAJAXHooks, _teardownAJAXHooks } from '@ember/test-helpers/settled'; +import { getContext, setContext, unsetContext } from '@ember/test-helpers'; import Ember from 'ember'; diff --git a/addon-test-support/legacy-0-6-x/build-registry.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/build-registry.js similarity index 100% rename from addon-test-support/legacy-0-6-x/build-registry.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/build-registry.js diff --git a/addon-test-support/legacy-0-6-x/test-module-for-acceptance.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-acceptance.js similarity index 92% rename from addon-test-support/legacy-0-6-x/test-module-for-acceptance.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-acceptance.js index 0fee40de3..f1c475fd8 100644 --- a/addon-test-support/legacy-0-6-x/test-module-for-acceptance.js +++ b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-acceptance.js @@ -1,6 +1,6 @@ import { run } from '@ember/runloop'; import AbstractTestModule from './abstract-test-module'; -import { getContext } from '../setup-context'; +import { getContext } from '@ember/test-helpers'; export default class extends AbstractTestModule { setupContext() { diff --git a/addon-test-support/legacy-0-6-x/test-module-for-component.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-component.js similarity index 100% rename from addon-test-support/legacy-0-6-x/test-module-for-component.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-component.js diff --git a/addon-test-support/legacy-0-6-x/test-module-for-model.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-model.js similarity index 100% rename from addon-test-support/legacy-0-6-x/test-module-for-model.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/test-module-for-model.js diff --git a/addon-test-support/legacy-0-6-x/test-module.js b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module.js similarity index 98% rename from addon-test-support/legacy-0-6-x/test-module.js rename to addon-test-support/ember-test-helpers/legacy-0-6-x/test-module.js index e3740a497..1074a94fa 100644 --- a/addon-test-support/legacy-0-6-x/test-module.js +++ b/addon-test-support/ember-test-helpers/legacy-0-6-x/test-module.js @@ -6,9 +6,9 @@ import { set } from '@ember/object'; import { run } from '@ember/runloop'; import { setOwner } from '@ember/application'; import AbstractTestModule from './abstract-test-module'; -import { getResolver } from '../resolver'; +import { getResolver } from '@ember/test-helpers'; import buildRegistry from './build-registry'; -import hasEmberVersion from '../has-ember-version'; +import hasEmberVersion from '@ember/test-helpers/has-ember-version'; export default class extends AbstractTestModule { constructor(subjectName, description, callbacks) { diff --git a/addon-test-support/wait.js b/addon-test-support/ember-test-helpers/wait.js similarity index 75% rename from addon-test-support/wait.js rename to addon-test-support/ember-test-helpers/wait.js index a12575082..132e3d7ae 100644 --- a/addon-test-support/wait.js +++ b/addon-test-support/ember-test-helpers/wait.js @@ -4,4 +4,4 @@ export { _setupPromiseListeners, _teardownAJAXHooks, _teardownPromiseListeners, -} from './settled'; +} from '@ember/test-helpers/settled'; diff --git a/index.js b/index.js index 001e55d6c..478241c6a 100644 --- a/index.js +++ b/index.js @@ -9,15 +9,7 @@ module.exports = { // so that can have our `import`'s be // import { ... } from 'ember-test-helpers'; - const Funnel = require('broccoli-funnel'); - - let namespacedTree = new Funnel(tree, { - srcDir: '/', - destDir: `/${this.moduleName()}`, - annotation: `Addon#treeForTestSupport (${this.name})`, - }); - - return this.preprocessJs(namespacedTree, '/', this.name, { + return this.preprocessJs(tree, '/', this.name, { registry: this.registry, }); }, diff --git a/package.json b/package.json index 35cd328c5..65b886312 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ember-test-helpers", + "name": "@ember/test-helpers", "version": "0.7.0-beta.11", "description": "Helpers for testing Ember.js applications", "keywords": [