diff --git a/test-scenarios/indirect-test.ts b/test-scenarios/indirect-test.ts index f9cc5dc1a..1de863cbe 100644 --- a/test-scenarios/indirect-test.ts +++ b/test-scenarios/indirect-test.ts @@ -11,6 +11,18 @@ function makeAddon() { addon.linkDependency('ember-auto-import', { baseDir: __dirname }); addon.pkg.name = 'sample-addon'; merge(addon.files, { + 'index.js': ` + 'use strict'; + + module.exports = { + name: require('./package').name, + options: { + babel: { + plugins: [ require.resolve('ember-auto-import/babel-plugin') ] + } + } + }; + `, app: { components: { 'from-sample-addon.js': ` @@ -19,6 +31,12 @@ function makeAddon() { }, }, addon: { + 'index.js': ` + export async function useExtra() { + let { extra } = await import('some-lib/extra'); + return extra(); + } + `, components: { 'from-sample-addon.js': ` import Component from '@ember/component'; @@ -52,10 +70,15 @@ function makeAddon() { addon.addDependency('some-lib', { files: { 'index.js': ` - export function makeMessage() { - return "This is the message"; - } - `, + export function makeMessage() { + return "This is the message"; + } + `, + 'extra.js': ` + export function extra() { + return "This is from the extra module that we lazily load"; + } + `, }, }); @@ -147,6 +170,19 @@ appScenarios }); `, }, + unit: { + 'addon-dynamic-import-test.js': ` + import { module, test } from 'qunit'; + import { useExtra } from 'sample-addon'; + + module('Unit | addon-dynamic-import', function () { + test('addon can load a dependency dynamically', async function(assert) { + let result = await useExtra(); + assert.equal(result, "This is from the extra module that we lazily load"); + }); + }); + `, + }, }, }); }) diff --git a/test-scenarios/scenarios.ts b/test-scenarios/scenarios.ts index ee2d73ae6..7b22e7d9a 100644 --- a/test-scenarios/scenarios.ts +++ b/test-scenarios/scenarios.ts @@ -16,24 +16,24 @@ import { dirname, delimiter } from 'path'; })(); async function lts(project: Project) { - project.linkDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-2.18' }); + project.linkDevDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-2.18' }); project.pkg.volta = { node: '10.24.0', }; } async function release(project: Project) { - project.linkDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-latest' }); + project.linkDevDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-latest' }); } async function beta(project: Project) { - project.linkDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-beta' }); + project.linkDevDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli-beta' }); } // canary is not aliased in our package.json, because NPM doesn't support // aliasing of non-registry deps async function canary(project: Project) { - project.linkDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli' }); + project.linkDevDependency('ember-cli', { baseDir: __dirname, resolveName: 'ember-cli' }); } export function supportMatrix(scenarios: Scenarios) {