diff --git a/package.json b/package.json index 763d1ccb..69cce36a 100644 --- a/package.json +++ b/package.json @@ -35,10 +35,11 @@ "ember-cli-htmlbars": "^3.0.1", "ember-cli-htmlbars-inline-precompile": "^2.1.0", "ember-cli-inject-live-reload": "^2.0.1", - "ember-cli-mocha": "^0.15.0", "ember-cli-shims": "^1.0.2", "ember-disable-prototype-extensions": "^1.1.0", "ember-load-initializers": "^2.0.0", + "ember-maybe-import-regenerator": "^0.1.6", + "ember-mocha": "^0.14.0", "ember-resolver": "^5.0.1", "ember-source": "~3.9.0", "ember-try": "^1.1.0", diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js index 366369bd..0b265c87 100644 --- a/tests/.eslintrc.js +++ b/tests/.eslintrc.js @@ -1,3 +1,6 @@ module.exports = { extends: 'simplabs/configs/ember-qunit', + parserOptions: { + ecmaVersion: 2017 + }, }; diff --git a/tests/dummy/app/templates/components/dummy-component.hbs b/tests/dummy/app/templates/components/dummy-component.hbs deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index a0bc4baa..a0503cb7 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -42,6 +42,7 @@ module.exports = function(environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; + ENV.APP.autoboot = false; } if (environment === 'production') { diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js deleted file mode 100644 index e7f983bd..00000000 --- a/tests/helpers/destroy-app.js +++ /dev/null @@ -1,5 +0,0 @@ -import { run } from '@ember/runloop'; - -export default function destroyApp(application) { - run(application, 'destroy'); -} diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js deleted file mode 100644 index 0daf9c9a..00000000 --- a/tests/helpers/module-for-acceptance.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Promise } from 'rsvp'; -import { module } from 'qunit'; -import startApp from '../helpers/start-app'; -import destroyApp from '../helpers/destroy-app'; - -export default function(name, options = {}) { - module(name, { - beforeEach() { - this.application = startApp(); - - if (options.beforeEach) { - return options.beforeEach.apply(this, arguments); - } - }, - - afterEach() { - let afterEach = options.afterEach && options.afterEach.apply(this, arguments); - return Promise.resolve(afterEach).then(() => destroyApp(this.application)); - } - }); -} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js deleted file mode 100644 index b208d38d..00000000 --- a/tests/helpers/resolver.js +++ /dev/null @@ -1,11 +0,0 @@ -import Resolver from '../../resolver'; -import config from '../../config/environment'; - -const resolver = Resolver.create(); - -resolver.namespace = { - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix -}; - -export default resolver; diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js deleted file mode 100644 index 6febddfb..00000000 --- a/tests/helpers/start-app.js +++ /dev/null @@ -1,16 +0,0 @@ -import { run } from '@ember/runloop'; -import { merge } from '@ember/polyfills'; -import Application from '../../app'; -import config from '../../config/environment'; - -export default function startApp(attrs) { - let attributes = merge({}, config.APP); - attributes = merge(attributes, attrs); // use defaults, but you can override; - - return run(() => { - let application = Application.create(attributes); - application.setupForTesting(); - application.injectTestHelpers(); - return application; - }); -} diff --git a/tests/integration/.gitkeep b/tests/integration/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/integration/components/dummy-component-test.js b/tests/minifier-test.js similarity index 82% rename from tests/integration/components/dummy-component-test.js rename to tests/minifier-test.js index 87bd6864..763b9fd3 100644 --- a/tests/integration/components/dummy-component-test.js +++ b/tests/minifier-test.js @@ -1,17 +1,18 @@ import { expect } from 'chai'; import { describe, it, beforeEach } from 'mocha'; -import { setupComponentTest } from 'ember-mocha'; +import { setupRenderingTest } from 'ember-mocha'; +import { render } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; describe('HBS Minifier plugin', function() { - setupComponentTest('dummy-component', { integration: true }); + setupRenderingTest(); beforeEach(function() { this.setProperties({ foo: 'foo', bar: 'bar', baz: 'baz' }); }); - it('collapses whitespace into single space character', function() { - this.render(hbs`{{foo}} \n\n \n{{bar}}`); + it('collapses whitespace into single space character', async function() { + await render(hbs`{{foo}} \n\n \n{{bar}}`); let childNodes = [...this.$()[0].childNodes].filter(it => it.textContent !== ''); expect(childNodes.length).to.equal(3); @@ -19,8 +20,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[1]).to.have.a.property('textContent', ' '); }); - it('strips leading and trailing whitespace from Program nodes', function() { - this.render(hbs` {{foo}} `); + it('strips leading and trailing whitespace from Program nodes', async function() { + await render(hbs` {{foo}} `); let childNodes = [...this.$()[0].childNodes].filter(it => it.textContent !== ''); expect(childNodes.length).to.equal(1); @@ -28,8 +29,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[0]).to.have.a.property('textContent', 'foo'); }); - it('Collapse leading/trailing text from Program nodes into a single whitespace', function() { - this.render(hbs`x {{foo}} y `); + it('Collapse leading/trailing text from Program nodes into a single whitespace', async function() { + await render(hbs`x {{foo}} y `); let childNodes = [...this.$()[0].childNodes].filter(it => it.textContent !== ''); expect(childNodes.length).to.equal(3); @@ -41,8 +42,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2]).to.have.a.property('textContent', ' y '); }); - it('strips leading and trailing whitespace from ElementNode nodes', function() { - this.render(hbs`
tags', function() { - this.render(hbs`{{foo}}`); + it('does not strip inside oftags', async function() { + await render(hbs`{{foo}}`); let childNodes = this.$('pre')[0].childNodes; expect(childNodes.length).to.equal(3); @@ -78,8 +79,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2]).to.have.a.property('textContent', ' '); }); - it('does not collapse whitespace inside oftags', function() { - this.render(hbs`\n\n \n`); + it('does not collapse whitespace inside oftags', async function() { + await render(hbs`\n\n \n`); let childNodes = this.$('pre')[0].childNodes; expect(childNodes.length).to.equal(1); @@ -87,8 +88,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[0]).to.have.a.property('textContent', ' \n\n \n'); }); - it('does not strip inside of {{#no-minify}} tags', function() { - this.render(hbs`{{#no-minify}} {{foo}} {{/no-minify}}`); + it('does not strip inside of {{#no-minify}} tags', async function() { + await render(hbs`{{#no-minify}} {{foo}} {{/no-minify}}`); let childNodes = [...this.$()[0].childNodes].filter(it => it.textContent !== ''); expect(childNodes.length).to.equal(3); @@ -100,8 +101,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2]).to.have.a.property('textContent', ' '); }); - it('does not strip inside of {{#no-minify}} tags in other tags', function() { - this.render(hbs`{{#no-minify}} {{foo}} {{/no-minify}}`); + it('does not strip inside of {{#no-minify}} tags in other tags', async function() { + await render(hbs`{{#no-minify}} {{foo}} {{/no-minify}}`); let childNodes = this.$('div')[0].childNodes; expect(childNodes.length).to.equal(3); @@ -113,8 +114,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2]).to.have.a.property('textContent', ' '); }); - it('does not collapse whitespace inside of {{#no-minify}} tags in other tags', function() { - this.render(hbs`{{#no-minify}} \n\n \n{{/no-minify}}`); + it('does not collapse whitespace inside of {{#no-minify}} tags in other tags', async function() { + await render(hbs`{{#no-minify}} \n\n \n{{/no-minify}}`); let childNodes = this.$('div')[0].childNodes; expect(childNodes.length).to.equal(1); @@ -122,8 +123,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[0]).to.have.a.property('textContent', ' \n\n \n'); }); - it('does not collapse multiple textNode into a single whitespace', function() { - this.render(hbs`1 2`); + it('does not collapse multiple textNode into a single whitespace', async function() { + await render(hbs`1 2`); let childNodes = [...this.$()[0].childNodes].filter(it => it.textContent !== ''); expect(childNodes.length).to.equal(3); expect(childNodes[1]).to.be.a('text'); @@ -136,8 +137,8 @@ describe('HBS Minifier plugin', function() { The following test is so much similar to the above one. But we need to make sure that the textNode in following templates results in ' 1 ' and not ' 1 '. */ - it('does not collapse surrounding a text content into a single whitespace', function() { - this.render(hbs ` + it('does not collapse surrounding a text content into a single whitespace', async function() { + await render(hbs `1 2 @@ -149,8 +150,8 @@ describe('HBS Minifier plugin', function() { expect(childNode.textContent.trim()).to.equal('1'); }); - it('does not minify `tagNames` specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('does not minify `tagNames` specified in .hbs-minifyrc.js', async function() { + await render(hbs ` Box 564, @@ -170,8 +171,8 @@ describe('HBS Minifier plugin', function() { }); - it('does not minify `classNames` specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('does not minify `classNames` specified in .hbs-minifyrc.js', async function() { + await render(hbs `1 @@ -185,8 +186,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2].textContent).to.equal('\n'); }); - it('does not minify `component` boundaries specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('does not minify `component` boundaries specified in .hbs-minifyrc.js', async function() { + await render(hbs ` {{#foo-bar}} yield content @@ -203,8 +204,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[7].textContent).to.equal('\n'); }); - it('minify `tagNames` that are not specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('minify `tagNames` that are not specified in .hbs-minifyrc.js', async function() { + await render(hbs `
- 1 @@ -221,8 +222,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[2].textContent).to.equal(' 2 '); }); - it('minifies `classNames` that are not specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('minifies `classNames` that are not specified in .hbs-minifyrc.js', async function() { + await render(hbs `
1 @@ -236,8 +237,8 @@ describe('HBS Minifier plugin', function() { expect(childNodes[1].textContent).to.equal(' 2 '); }); - it('minify `component` boundaries that are not specified in .hbs-minifyrc.js', function() { - this.render(hbs ` + it('minify `component` boundaries that are not specified in .hbs-minifyrc.js', async function() { + await render(hbs ` {{#x-button tagName="button"}}yield content diff --git a/tests/test-helper.js b/tests/test-helper.js index bbe42fab..b366f7b9 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,4 +1,5 @@ -import resolver from './helpers/resolver'; -import { setResolver } from 'ember-mocha'; +import Application from '../app'; +import config from '../config/environment'; +import { setApplication } from '@ember/test-helpers'; -setResolver(resolver); +setApplication(Application.create(config.APP)); diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/yarn.lock b/yarn.lock index 0bcc4d57..53a498a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -694,12 +694,14 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@ember/test-helpers@^0.7.16": - version "0.7.16" - resolved "https://registry.yarnpkg.com/@ember/test-helpers/-/test-helpers-0.7.16.tgz#73a4acf4c7d1b92ce866f4c9e40c9723da4cf1e8" +"@ember/test-helpers@^0.7.18": + version "0.7.27" + resolved "https://registry.yarnpkg.com/@ember/test-helpers/-/test-helpers-0.7.27.tgz#c622cabd0cbb95b34efc1e1b6274ab5a14edc138" + integrity sha512-AQESk0FTFxRY6GyZ8PharR4SC7Fju0rXqNkfNYIntAjzefZ8xEqEM4iXDj5h7gAvfx/8dA69AQ9+p7ubc+KvJg== dependencies: broccoli-funnel "^2.0.1" - ember-cli-babel "^6.10.0" + ember-assign-polyfill "~2.4.0" + ember-cli-babel "^6.12.0" ember-cli-htmlbars-inline-precompile "^1.0.0" "@glimmer/di@^0.2.0": @@ -3186,11 +3188,19 @@ electron-to-chromium@^1.3.86: version "1.3.88" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.88.tgz#f36ab32634f49ef2b0fdc1e82e2d1cc17feb29e7" +ember-assign-polyfill@~2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/ember-assign-polyfill/-/ember-assign-polyfill-2.4.0.tgz#acb00466f7d674b3e6b030acfe255b3b1f6472e1" + integrity sha512-0SnGQb9CenRqbZdIa1KFsEjT+1ijGWfAbCSaDbg5uVa5l6HPdppuTzOXK6sfEQMsd2nbrp27QWFy7W5VX6l4Ag== + dependencies: + ember-cli-babel "^6.6.0" + ember-cli-version-checker "^2.0.0" + ember-cli-babel-plugin-helpers@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.1.0.tgz#de3baedd093163b6c2461f95964888c1676325ac" -ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1: +ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1: version "6.18.0" resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.18.0.tgz#3f6435fd275172edeff2b634ee7b29ce74318957" dependencies: @@ -3326,12 +3336,6 @@ ember-cli-lodash-subset@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/ember-cli-lodash-subset/-/ember-cli-lodash-subset-2.0.1.tgz#20cb68a790fe0fde2488ddfd8efbb7df6fe766f2" -ember-cli-mocha@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/ember-cli-mocha/-/ember-cli-mocha-0.15.0.tgz#483b25a2c631b2b1913344686f497a81ced669b6" - dependencies: - ember-mocha "^0.13.0" - ember-cli-normalize-entity-name@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ember-cli-normalize-entity-name/-/ember-cli-normalize-entity-name-1.0.0.tgz#0b14f7bcbc599aa117b5fddc81e4fd03c4bad5b7" @@ -3495,11 +3499,22 @@ ember-load-initializers@^2.0.0: dependencies: ember-cli-babel "^7.0.0" -ember-mocha@^0.13.0: - version "0.13.1" - resolved "https://registry.yarnpkg.com/ember-mocha/-/ember-mocha-0.13.1.tgz#6c42d76fc7e5579a1ca8499621317b6cde7b4381" +ember-maybe-import-regenerator@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/ember-maybe-import-regenerator/-/ember-maybe-import-regenerator-0.1.6.tgz#35d41828afa6d6a59bc0da3ce47f34c573d776ca" + integrity sha1-NdQYKK+m1qWbwNo85H80xXPXdso= + dependencies: + broccoli-funnel "^1.0.1" + broccoli-merge-trees "^1.0.0" + ember-cli-babel "^6.0.0-beta.4" + regenerator-runtime "^0.9.5" + +ember-mocha@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/ember-mocha/-/ember-mocha-0.14.0.tgz#5c14cc1fa7545fe262461856c4ffaf9a662db721" + integrity sha1-XBTMH6dUX+JiRhhWxP+vmmYttyE= dependencies: - "@ember/test-helpers" "^0.7.16" + "@ember/test-helpers" "^0.7.18" broccoli-funnel "^2.0.1" broccoli-merge-trees "^2.0.0" common-tags "^1.5.1" @@ -7455,6 +7470,11 @@ regenerator-runtime@^0.12.0: version "0.12.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" +regenerator-runtime@^0.9.5: + version "0.9.6" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.9.6.tgz#d33eb95d0d2001a4be39659707c51b0cb71ce029" + integrity sha1-0z65XQ0gAaS+OWWXB8UbDLcc4Ck= + regenerator-transform@^0.10.0: version "0.10.1" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.10.1.tgz#1e4996837231da8b7f3cf4114d71b5691a0680dd"