From 326497b70c274dc4cf128d64477c478a45afa09c Mon Sep 17 00:00:00 2001 From: Bert De Block Date: Sun, 12 Jun 2022 21:15:10 +0200 Subject: [PATCH] Consistent determination of `modulePrefix` in blueprints --- .../qunit-files/__root__/__testType__/__name__-test.js | 2 +- .../__root__/__testType__/__name__-test.js | 2 +- blueprints/initializer-test/index.js | 5 ++--- blueprints/instance-initializer-test/index.js | 6 ++---- blueprints/util-test/index.js | 4 ++-- .../qunit-files/__root__/__testType__/__name__-test.js | 2 +- .../__root__/__testType__/__name__-test.ts | 2 +- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js b/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js index d9eeb2bbb93..2a10306510e 100644 --- a/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js +++ b/blueprints-js/util-test/qunit-files/__root__/__testType__/__name__-test.js @@ -1,4 +1,4 @@ -import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>'; +import <%= camelizedModuleName %> from '<%= modulePrefix %>/utils/<%= dasherizedModuleName %>'; import { module, test } from 'qunit'; module('<%= friendlyTestName %>'); diff --git a/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js b/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js index d531b5ee8d0..0278e54bdfb 100644 --- a/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +++ b/blueprints-js/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js @@ -1,4 +1,4 @@ -import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>'; +import <%= camelizedModuleName %> from '<%= modulePrefix %>/utils/<%= dasherizedModuleName %>'; import { module, test } from 'qunit'; module('<%= friendlyTestName %>', function () { diff --git a/blueprints/initializer-test/index.js b/blueprints/initializer-test/index.js index bc4755eca15..fd0ae11bd87 100644 --- a/blueprints/initializer-test/index.js +++ b/blueprints/initializer-test/index.js @@ -2,9 +2,9 @@ const fs = require('fs'); const path = require('path'); -const stringUtils = require('ember-cli-string-utils'); const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints'); +const { modulePrefixForProject } = require('../-utils'); const useTestFrameworkDetector = require('../test-framework-detector'); module.exports = useTestFrameworkDetector({ @@ -29,10 +29,9 @@ module.exports = useTestFrameworkDetector({ }, locals: function (options) { - let modulePrefix = stringUtils.dasherize(options.project.config().modulePrefix); return { friendlyTestName: ['Unit', 'Initializer', options.entity.name].join(' | '), - modulePrefix, + modulePrefix: modulePrefixForProject(options.project), destroyAppExists: fs.existsSync( path.join(this.project.root, '/tests/helpers/destroy-app.js') ), diff --git a/blueprints/instance-initializer-test/index.js b/blueprints/instance-initializer-test/index.js index b691b4a8b41..53f87ae56ef 100644 --- a/blueprints/instance-initializer-test/index.js +++ b/blueprints/instance-initializer-test/index.js @@ -2,9 +2,9 @@ const fs = require('fs'); const path = require('path'); -const stringUtils = require('ember-cli-string-utils'); const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints'); +const { modulePrefixForProject } = require('../-utils'); const useTestFrameworkDetector = require('../test-framework-detector'); module.exports = useTestFrameworkDetector({ @@ -28,11 +28,9 @@ module.exports = useTestFrameworkDetector({ }; }, locals: function (options) { - let modulePrefix = stringUtils.dasherize(options.project.config().modulePrefix); - return { friendlyTestName: ['Unit', 'Instance Initializer', options.entity.name].join(' | '), - modulePrefix, + modulePrefix: modulePrefixForProject(options.project), destroyAppExists: fs.existsSync( path.join(this.project.root, '/tests/helpers/destroy-app.js') ), diff --git a/blueprints/util-test/index.js b/blueprints/util-test/index.js index 55b63152b02..ebc7e416402 100644 --- a/blueprints/util-test/index.js +++ b/blueprints/util-test/index.js @@ -1,9 +1,9 @@ 'use strict'; -const stringUtils = require('ember-cli-string-utils'); const path = require('path'); const maybePolyfillTypeScriptBlueprints = require('../-maybe-polyfill-typescript-blueprints'); +const { modulePrefixForProject } = require('../-utils'); const useTestFrameworkDetector = require('../test-framework-detector'); module.exports = useTestFrameworkDetector({ @@ -30,7 +30,7 @@ module.exports = useTestFrameworkDetector({ locals: function (options) { return { friendlyTestName: ['Unit', 'Utility', options.entity.name].join(' | '), - dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix), + modulePrefix: modulePrefixForProject(options.project), }; }, }); diff --git a/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js b/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js index d9eeb2bbb93..2a10306510e 100644 --- a/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js +++ b/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js @@ -1,4 +1,4 @@ -import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>'; +import <%= camelizedModuleName %> from '<%= modulePrefix %>/utils/<%= dasherizedModuleName %>'; import { module, test } from 'qunit'; module('<%= friendlyTestName %>'); diff --git a/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.ts b/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.ts index d531b5ee8d0..0278e54bdfb 100644 --- a/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.ts +++ b/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.ts @@ -1,4 +1,4 @@ -import <%= camelizedModuleName %> from '<%= dasherizedModulePrefix %>/utils/<%= dasherizedModuleName %>'; +import <%= camelizedModuleName %> from '<%= modulePrefix %>/utils/<%= dasherizedModuleName %>'; import { module, test } from 'qunit'; module('<%= friendlyTestName %>', function () {