Skip to content

Commit

Permalink
Expanding test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Mar 24, 2021
1 parent 8c8bb1c commit ebf9241
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
44 changes: 40 additions & 4 deletions test-scenarios/indirect-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': `
Expand All @@ -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';
Expand Down Expand Up @@ -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";
}
`,
},
});

Expand Down Expand Up @@ -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");
});
});
`,
},
},
});
})
Expand Down
8 changes: 4 additions & 4 deletions test-scenarios/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ebf9241

Please sign in to comment.