diff --git a/test-scenarios/static-import-test.ts b/test-scenarios/static-import-test.ts index 0c7fe83c..1bb33570 100644 --- a/test-scenarios/static-import-test.ts +++ b/test-scenarios/static-import-test.ts @@ -32,11 +32,13 @@ function staticImportTest(project: Project) { merge(project.files, { 'ember-cli-build.js': ` const EmberApp = require('ember-cli/lib/broccoli/ember-app'); + const { dirname, join } = require('path'); module.exports = function (defaults) { let app = new EmberApp(defaults, { autoImport: { alias: { - 'my-aliased-package': 'original-package' + 'my-aliased-package': 'original-package', + 'dual-build-package': join(dirname(require.resolve('dual-build-package', { paths: [process.cwd()] })), 'dist/index.mjs'), }, watchDependencies: [ 'original-package' @@ -235,6 +237,16 @@ function staticImportTest(project: Project) { }); }); `, + 'absolute-alias-test.js': ` + import { module, test } from 'qunit'; + import value from 'dual-build-package'; + + module('Unit | absolute alias', function () { + test('can import package with absolute alias', function (assert) { + assert.equal(value, 'This is ESM'); + }); + }); + `, 'allow-app-imports-test.js': ` import { module, test } from 'qunit'; import example1 from '@ef4/app-template/lib/example1'; @@ -359,6 +371,15 @@ function staticImportTest(project: Project) { }, }); + project.addDevDependency('dual-build-package', { + files: { + 'index.js': `throw new Error('This should not get imported!)`, + dist: { + 'index.mjs': `export default value = 'This is ESM';`, + }, + }, + }); + project.addDevDependency('@ef4/scoped-lib', { files: { 'index.js': `