Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ember-cli to latest throughout test infrastructure #961

Merged
merged 16 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"ember-cli-htmlbars-inline-precompile": "^2.1.0",
"ember-cli-htmlbars-3": "npm:ember-cli-htmlbars@3",
"@glimmer/syntax": "0.80.0",
"ember-engines": "^0.8.15",
"ember-engines": "^0.8.19",
"typescript": "*"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/src/get-real-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let TARGET_INSTANCE_SYMBOL: any;

try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies
const targetInstanceModule = require('ember-cli/lib/models/per-bundle-addon-cache/target-instance');

if (targetInstanceModule) {
Expand Down
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"broccoli-asset-rev": "^3.0.0",
"cross-env": "^7.0.3",
"ember-auto-import": "^1.11.2",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-htmlbars": "^4.3.1",
"ember-cli-inject-live-reload": "^1.8.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/util/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = async function () {
},
npm: {
devDependencies: {
'@ember/jquery': '^1.1.0',
'@ember/jquery': '^2.0.0',
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"ember-cli-babel": "^7.23.1"
},
"devDependencies": {
"@ember/jquery": "^2.0.0",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.4.2",
"@embroider/compat": "0.44.1",
Expand All @@ -48,7 +49,7 @@
"broccoli-asset-rev": "^3.0.0",
"cross-env": "^7.0.3",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.3.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
2 changes: 1 addition & 1 deletion test-packages/fastboot-addon/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = async function() {
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1'
'@ember/jquery': '^2.0.0'
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion test-packages/fastboot-addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-cli-sri": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions test-packages/sample-transforms/config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function() {
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'@ember/jquery': '^2.0.0',
'ember-source': '~2.18.0'
}
}
Expand Down Expand Up @@ -74,7 +74,7 @@ module.exports = function() {
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1'
'@ember/jquery': '^2.0.0'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@embroider/test-support": "0.36.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^5.1.0",
"ember-cli-htmlbars": "^4.3.1",
Expand Down
2 changes: 1 addition & 1 deletion test-packages/support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"broccoli": "^3.4.2",
"console-ui": "^3.0.0",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-babel": "^7.20.5",
"ember-cli-htmlbars": "^4.2.0",
"ember-resolver": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/addon-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-cli-sri": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion tests/app-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^2.2.0",
"ember-cli": "~3.27.0",
"ember-cli": "~3.28.0",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-dependency-checker": "^3.2.0",
Expand Down
40 changes: 31 additions & 9 deletions tests/scenarios/engines-test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
import { appScenarios } from './scenarios';
import { appScenarios, baseAddon } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
import { setupFastboot, loadFromFixtureData } from './helpers';
import { dirname } from 'path';
const { module: Qmodule, test } = QUnit;

// Both ember-engines and its dependency ember-asset-loader have undeclared
// peerDependencies on ember-cli.
function emberEngines(): Project {
let enginesPath = dirname(require.resolve('ember-engines/package.json'));
let engines = Project.fromDir(enginesPath, { linkDeps: true });
engines.pkg.peerDependencies = Object.assign(
{
'ember-cli': '*',
},
engines.pkg.peerDependencies
);
let assetLoader = Project.fromDir(dirname(require.resolve('ember-asset-loader', { paths: [enginesPath] })), {
linkDeps: true,
});
assetLoader.pkg.peerDependencies = Object.assign(
{
'ember-cli': '*',
},
assetLoader.pkg.peerDependencies
);
engines.addDependency(assetLoader);
return engines;
}

appScenarios
.map('engines', project => {
let eagerEngine = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), { linkDeps: true });
let lazyEngine = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), { linkDeps: true });
let macroSampleAddon = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), {
linkDeps: true,
});
let eagerEngine = baseAddon();
let lazyEngine = baseAddon();
let macroSampleAddon = baseAddon();

merge(eagerEngine.files, loadFromFixtureData('eager-engine'));
merge(lazyEngine.files, loadFromFixtureData('lazy-engine'));
Expand Down Expand Up @@ -43,11 +65,11 @@ appScenarios
project.linkDependency('ember-cli-fastboot', { baseDir: __dirname });
project.linkDependency('fastboot', { baseDir: __dirname });
project.linkDependency('ember-truth-helpers', { baseDir: __dirname });
project.linkDependency('ember-engines', { baseDir: __dirname });
project.addDependency(emberEngines());
eagerEngine.linkDependency('ember-truth-helpers', { baseDir: __dirname });
eagerEngine.linkDependency('ember-engines', { baseDir: __dirname });
eagerEngine.addDependency(emberEngines());
lazyEngine.linkDependency('ember-truth-helpers', { baseDir: __dirname });
lazyEngine.linkDependency('ember-engines', { baseDir: __dirname });
lazyEngine.addDependency(emberEngines());
macroSampleAddon.linkDependency('@embroider/macros', { baseDir: __dirname });

let engineTestFiles = loadFromFixtureData('engines-host-app');
Expand Down
14 changes: 5 additions & 9 deletions tests/scenarios/macro-test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { appScenarios, appReleaseScenario, addonScenarios } from './scenarios';
import { appScenarios, appReleaseScenario, dummyAppScenarios, baseAddon } from './scenarios';
import { PreparedApp, Project } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
import { dirname, join } from 'path';
import { join } from 'path';
import { loadFromFixtureData } from './helpers';
import fs from 'fs-extra';
const { module: Qmodule, test } = QUnit;
Expand All @@ -19,12 +19,8 @@ function updateLodashVersion(app: PreparedApp, version: string) {
}

function scenarioSetup(project: Project) {
let macroSampleAddon = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), {
linkDeps: true,
});
let funkySampleAddon = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), {
linkDeps: true,
});
let macroSampleAddon = baseAddon();
let funkySampleAddon = baseAddon();

macroSampleAddon.pkg.name = 'macro-sample-addon';
funkySampleAddon.pkg.name = '@embroider/funky-sample-addon';
Expand Down Expand Up @@ -113,7 +109,7 @@ appReleaseScenario
});
});

addonScenarios
dummyAppScenarios
.map('macro-sample-addon', project => {
let addonFiles = loadFromFixtureData('macro-sample-addon');
project.name = 'macro-sample-addon';
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"jsdom": "^16.2.2",
"lodash": "^4.17.20",
"qunit": "^2.16.0",
"scenario-tester": "^1.0.2",
"scenario-tester": "^2.0.1",
"ts-node": "^9.1.1"
},
"scripts": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"ember-data-3.20": "npm:ember-data@~3.20.0",
"ember-data-3.24": "npm:ember-data@~3.24.0",
"ember-data-latest": "npm:ember-data@latest",
"ember-engines": "^0.8.16",
"ember-engines": "^0.8.17",
"ember-inline-svg": "^0.2.1",
"ember-source-latest": "npm:ember-source@latest",
"ember-source-beta": "npm:ember-source@beta",
Expand Down
10 changes: 4 additions & 6 deletions tests/scenarios/preprocess-test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
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 { loadFromFixtureData } from './helpers';
import { dirname, join } from 'path';
import { join } from 'path';
import fs from 'fs';
const { module: Qmodule, test } = QUnit;

appScenarios
.map('preprocess', project => {
let preprocessAddon = Project.fromDir(dirname(require.resolve('../addon-template/package.json')), {
linkDeps: true,
});
let preprocessAddon = baseAddon();

merge(preprocessAddon.files, loadFromFixtureData('preprocess-addon'));
preprocessAddon.linkDependency('broccoli-funnel', { baseDir: __dirname });
Expand Down
21 changes: 14 additions & 7 deletions tests/scenarios/scenarios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ export function onlyRunRelease(scenarios: Scenarios) {
return scenarios.expand({ release });
}

export const appScenarios = supportMatrix(Scenarios.fromDir(dirname(require.resolve('../app-template/package.json'))));
export const addonScenarios = supportMatrix(
Scenarios.fromDir(dirname(require.resolve('../addon-template/package.json')))
);
export const appReleaseScenario = onlyRunRelease(
Scenarios.fromDir(dirname(require.resolve('../app-template/package.json')))
);
export function baseAddon(as: 'dummy-app' | 'dependency' = 'dependency') {
return Project.fromDir(
dirname(require.resolve('../addon-template/package.json')),
as === 'dummy-app' ? { linkDevDeps: true } : { linkDeps: true }
);
}

export function baseApp() {
return Project.fromDir(dirname(require.resolve('../app-template/package.json')), { linkDevDeps: true });
}

export const appScenarios = supportMatrix(Scenarios.fromProject(baseApp));
export const dummyAppScenarios = supportMatrix(Scenarios.fromProject(() => baseAddon('dummy-app')));
export const appReleaseScenario = onlyRunRelease(Scenarios.fromProject(baseApp));
Loading