Skip to content

Commit

Permalink
Merge pull request #447 from ef4/test-new-scenario-tester
Browse files Browse the repository at this point in the history
upgrade scenario-tester
  • Loading branch information
ef4 authored Sep 14, 2021
2 parents 0fba64e + 7fca6e7 commit a88004f
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 115 deletions.
141 changes: 54 additions & 87 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ember-auto-import/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"quick-temp": "^0.1.8",
"qunit": "^2.6.1",
"qunit-assertions-extra": "^0.8.5",
"scenario-tester": "^1.0.0",
"scenario-tester": "^2.0.1",
"typescript": "4.3.5",
"webpack": "^5.31.0"
},
Expand Down
7 changes: 3 additions & 4 deletions test-scenarios/conflict-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { appScenarios } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import { appScenarios, baseAddon } from './scenarios';
import { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import { dirname } from 'path';
import merge from 'lodash/merge';
const { module: Qmodule, test } = QUnit;

Expand All @@ -22,7 +21,7 @@ appScenarios
},
});

let addon = Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
let addon = baseAddon();
addon.linkDependency('ember-auto-import', { baseDir: __dirname });
addon.addDependency('inner-lib', '2.3.4', { requestedRange: '^2.0.0' });
merge(addon.files, {
Expand Down
9 changes: 4 additions & 5 deletions test-scenarios/doubly-indirect-test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { appScenarios } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import { appScenarios, baseAddon } from './scenarios';
import { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
import { dirname } from 'path';
const { module: Qmodule, test } = QUnit;

function makeAddon() {
let addon = Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
let addon = baseAddon();
addon.linkDependency('ember-auto-import', { baseDir: __dirname });

addon.pkg.name = 'sample-addon';
Expand Down Expand Up @@ -72,7 +71,7 @@ function makeAddon() {
}

function makeIntermediateAddon() {
let addon = Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
let addon = baseAddon();
addon.pkg.name = 'intermediate-addon';
merge(addon.files, {
app: {
Expand Down
7 changes: 3 additions & 4 deletions test-scenarios/merged-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { appScenarios } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import { appScenarios, baseAddon } from './scenarios';
import { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
import path from 'path';
const { module: Qmodule, test } = QUnit;

appScenarios
Expand Down Expand Up @@ -47,7 +46,7 @@ appScenarios
},
});

let addon = Project.fromDir(path.dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
let addon = baseAddon();
addon.addDependency(innerLib.clone());
addon.addDependency(innerLib2.clone());
addon.linkDependency('ember-auto-import', { baseDir: __dirname });
Expand Down
7 changes: 3 additions & 4 deletions test-scenarios/no-conflict-test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { appScenarios } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import { appScenarios, baseAddon } from './scenarios';
import { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import { dirname } from 'path';
import merge from 'lodash/merge';
const { module: Qmodule, test } = QUnit;

Expand All @@ -21,7 +20,7 @@ appScenarios
},
});

let addon = Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
let addon = baseAddon();
addon.linkDependency('ember-auto-import', { baseDir: __dirname });
addon.addDependency('inner-lib', '1.3.4', { requestedRange: '^1.0.0' });
merge(addon.files, {
Expand Down
2 changes: 1 addition & 1 deletion test-scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@types/qunit": "^2.11.1",
"qunit": "^2.6.1",
"ts-node": "^9.1.1",
"scenario-tester": "^1.0.0",
"scenario-tester": "^2.0.1",
"jsdom": "^11.11.0"
},
"scripts": {
Expand Down
11 changes: 7 additions & 4 deletions test-scenarios/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ export function supportMatrix(scenarios: Scenarios) {
}

export function baseApp() {
return Project.fromDir(dirname(require.resolve('@ef4/app-template/package.json')), { linkDeps: true });
return Project.fromDir(dirname(require.resolve('@ef4/app-template/package.json')), { linkDevDeps: true });
}
export const appScenarios = supportMatrix(Scenarios.fromProject(baseApp));

export function baseAddon() {
return Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), { linkDeps: true });
export function baseAddon(as: 'addon' | 'dummy-app' = 'addon') {
return Project.fromDir(dirname(require.resolve('@ef4/addon-template/package.json')), {
linkDeps: true,
linkDevDeps: as === 'dummy-app',
});
}
export const addonScenarios = supportMatrix(Scenarios.fromProject(baseAddon));
export const addonScenarios = supportMatrix(Scenarios.fromProject(() => baseAddon('dummy-app')));
Loading

0 comments on commit a88004f

Please sign in to comment.