From 37d6bea2d9e410ca56e26f569ba7104e015cac62 Mon Sep 17 00:00:00 2001 From: Sergio Arbeo Date: Fri, 9 Feb 2018 17:04:10 +0100 Subject: [PATCH] [BUGFIX] Don't use destroyApp if new API is being used Fixes #16180 --- blueprints/acceptance-test/index.js | 2 +- blueprints/initializer-test/index.js | 5 ++++- .../qunit-files/tests/unit/initializers/__name__-test.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/blueprints/acceptance-test/index.js b/blueprints/acceptance-test/index.js index ec0655d1e68..9ac14b141b3 100644 --- a/blueprints/acceptance-test/index.js +++ b/blueprints/acceptance-test/index.js @@ -25,7 +25,7 @@ module.exports = useTestFrameworkDetector({ return { testFolderRoot: testFolderRoot, friendlyTestName, - destroyAppExists: destroyAppExists + destroyAppExists }; } }); diff --git a/blueprints/initializer-test/index.js b/blueprints/initializer-test/index.js index f2a17e45a3b..36b0cad01ac 100644 --- a/blueprints/initializer-test/index.js +++ b/blueprints/initializer-test/index.js @@ -1,6 +1,8 @@ 'use strict'; +const path = require('path'); const stringUtils = require('ember-cli-string-utils'); +const existsSync = require('exists-sync'); const useTestFrameworkDetector = require('../test-framework-detector'); @@ -9,7 +11,8 @@ module.exports = useTestFrameworkDetector({ locals: function(options) { return { friendlyTestName: ['Unit', 'Initializer', options.entity.name].join(' | '), - dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix) + dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix), + destroyAppExists: existsSync(path.join(this.project.root, '/tests/helpers/destroy-app.js')) }; } }); diff --git a/blueprints/initializer-test/qunit-files/tests/unit/initializers/__name__-test.js b/blueprints/initializer-test/qunit-files/tests/unit/initializers/__name__-test.js index c54768cb0df..38630689960 100644 --- a/blueprints/initializer-test/qunit-files/tests/unit/initializers/__name__-test.js +++ b/blueprints/initializer-test/qunit-files/tests/unit/initializers/__name__-test.js @@ -3,7 +3,7 @@ import { run } from '@ember/runloop'; import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>'; import { module, test } from 'qunit'; -import destroyApp from '../../helpers/destroy-app'; +<% if (destroyAppExists) { %>import destroyApp from '../../helpers/destroy-app';<% } else { %>import { run } from '@ember/runloop'; <% } %> module('<%= friendlyTestName %>', { beforeEach() { @@ -13,7 +13,7 @@ module('<%= friendlyTestName %>', { }); }, afterEach() { - destroyApp(this.application); + <% if (destroyAppExists) { %>destroyApp(this.application);<% } else { %>run(this.application, 'destroy');<% } %> } });