Skip to content

Commit

Permalink
Add failing test for absolutely aliased dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Oct 7, 2024
1 parent 2a2d239 commit df376fa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test-scenarios/static-import-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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': `
Expand Down

0 comments on commit df376fa

Please sign in to comment.