diff --git a/addon/index.js b/addon/index.js index bdf29fb..0ed2b44 100644 --- a/addon/index.js +++ b/addon/index.js @@ -23,6 +23,10 @@ function registerInstanceInitializers(app, moduleNames) { } } +function _endsWith(str, suffix) { + return str.indexOf(suffix, str.length - suffix.length) !== -1; +} + export default function (app, prefix) { var initializerPrefix = prefix + '/initializers/'; var instanceInitializerPrefix = prefix + '/instance-initializers/'; @@ -34,9 +38,13 @@ export default function (app, prefix) { for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; if (moduleName.lastIndexOf(initializerPrefix, 0) === 0) { - initializers.push(moduleName); + if (!_endsWith(moduleName, '-test')) { + initializers.push(moduleName); + } } else if (moduleName.lastIndexOf(instanceInitializerPrefix, 0) === 0) { - instanceInitializers.push(moduleName); + if (!_endsWith(moduleName, '-test')) { + instanceInitializers.push(moduleName); + } } } registerInitializers(app, initializers); diff --git a/package.json b/package.json index f83bd75..5e3323d 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "ember-data": "^2.17.0", "ember-disable-prototype-extensions": "^1.1.2", "ember-export-application-global": "^2.0.0", - "ember-load-initializers": "^1.0.0", "ember-maybe-import-regenerator": "^0.1.6", "ember-resolver": "^4.0.0", "ember-source": "~3.0.0", diff --git a/tests/dummy/app/initializers/foo-test.js b/tests/dummy/app/initializers/foo-test.js new file mode 100644 index 0000000..ff8b4c5 --- /dev/null +++ b/tests/dummy/app/initializers/foo-test.js @@ -0,0 +1 @@ +export default {}; diff --git a/tests/dummy/app/instance-initializers/bar-test.js b/tests/dummy/app/instance-initializers/bar-test.js new file mode 100644 index 0000000..ff8b4c5 --- /dev/null +++ b/tests/dummy/app/instance-initializers/bar-test.js @@ -0,0 +1 @@ +export default {};