From 235dfc4ea683ede21e230e86fb17c57f21101a2a Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Mon, 9 Sep 2024 10:28:33 +0200 Subject: [PATCH 1/3] Set EXTEND_PROTOTYPES: false for Ember v6 --- packages/addon-template/tests/dummy/config/environment.js | 5 +---- packages/app-template/config/environment.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/addon-template/tests/dummy/config/environment.js b/packages/addon-template/tests/dummy/config/environment.js index ba4e8cb76..f4fad93fb 100644 --- a/packages/addon-template/tests/dummy/config/environment.js +++ b/packages/addon-template/tests/dummy/config/environment.js @@ -11,10 +11,7 @@ module.exports = function (environment) { // Here you can enable experimental features on an ember canary build // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true }, - EXTEND_PROTOTYPES: { - // Prevent Ember Data from overriding Date.parse. - Date: false, - }, + EXTEND_PROTOTYPES: false, }, APP: { diff --git a/packages/app-template/config/environment.js b/packages/app-template/config/environment.js index 569542714..9202d13f7 100644 --- a/packages/app-template/config/environment.js +++ b/packages/app-template/config/environment.js @@ -11,10 +11,7 @@ module.exports = function (environment) { // Here you can enable experimental features on an ember canary build // e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true }, - EXTEND_PROTOTYPES: { - // Prevent Ember Data from overriding Date.parse. - Date: false, - }, + EXTEND_PROTOTYPES: false, }, APP: { From 646ece007e8fe608528f4600f5585ef284f29894 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Mon, 9 Sep 2024 11:33:14 +0200 Subject: [PATCH 2/3] Update volta invocation to work with volta v2 --- test-scenarios/addon-dev-dep-test.ts | 2 +- test-scenarios/babel-test.ts | 2 +- test-scenarios/common-chunk-test.ts | 2 +- test-scenarios/conflict-test.ts | 2 +- test-scenarios/csp-test.ts | 2 +- test-scenarios/custom-html-test.ts | 2 +- test-scenarios/customized-vendor-test.ts | 2 +- test-scenarios/doubly-indirect-test.ts | 2 +- test-scenarios/dynamic-import-test.ts | 2 +- test-scenarios/ember-cli-typescript-2-test.ts | 2 +- test-scenarios/ember-cli-typescript-3-test.ts | 2 +- test-scenarios/ember-cli-typescript-4-test.ts | 2 +- test-scenarios/fastboot-helper.ts | 2 +- test-scenarios/import-sync-test.ts | 7 ++++--- test-scenarios/indirect-test.ts | 4 ++-- test-scenarios/layering-test.ts | 2 +- test-scenarios/leader-test.ts | 6 +++--- test-scenarios/merged-test.ts | 2 +- test-scenarios/no-conflict-test.ts | 2 +- test-scenarios/node-es-modules.ts | 2 +- test-scenarios/sample-addon-test.ts | 2 +- test-scenarios/static-import-test.ts | 4 ++-- test-scenarios/targets-test.ts | 2 +- test-scenarios/v2-addon-test.ts | 6 +++--- test-scenarios/webpack-config-test.ts | 2 +- 25 files changed, 34 insertions(+), 33 deletions(-) diff --git a/test-scenarios/addon-dev-dep-test.ts b/test-scenarios/addon-dev-dep-test.ts index 78de79a04..adc8bbb33 100644 --- a/test-scenarios/addon-dev-dep-test.ts +++ b/test-scenarios/addon-dev-dep-test.ts @@ -25,7 +25,7 @@ addonScenarios app = await scenario.prepare(); }); test('ensure build error', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.notEqual(result.exitCode, 0, result.output); assert.ok( /@ef4\/addon-template tried to import \"some-lib\" in \"@ef4\/addon-template\/index.js\" from addon code, but \"some-lib\" is a devDependency/.test( diff --git a/test-scenarios/babel-test.ts b/test-scenarios/babel-test.ts index 6d8a183fa..7b77a41b3 100644 --- a/test-scenarios/babel-test.ts +++ b/test-scenarios/babel-test.ts @@ -100,7 +100,7 @@ appScenarios app = await scenario.prepare(); }); test('yarn test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/common-chunk-test.ts b/test-scenarios/common-chunk-test.ts index d3e9a74eb..c1a5e44ce 100644 --- a/test-scenarios/common-chunk-test.ts +++ b/test-scenarios/common-chunk-test.ts @@ -95,7 +95,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/conflict-test.ts b/test-scenarios/conflict-test.ts index 4d727a94e..f031f296d 100644 --- a/test-scenarios/conflict-test.ts +++ b/test-scenarios/conflict-test.ts @@ -44,7 +44,7 @@ appScenarios app = await scenario.prepare(); }); test('ensure build error', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.notEqual(result.exitCode, 0, result.output); assert.ok( /@ef4\/app-template needs inner-lib satisfying \^1.0.0, but we have version 2.3.4 because of @ef4\/addon-template/.test( diff --git a/test-scenarios/csp-test.ts b/test-scenarios/csp-test.ts index a555a8a55..96349155d 100644 --- a/test-scenarios/csp-test.ts +++ b/test-scenarios/csp-test.ts @@ -128,7 +128,7 @@ appScenarios app = await scenario.prepare(); }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/custom-html-test.ts b/test-scenarios/custom-html-test.ts index a210a6b55..a920d5064 100644 --- a/test-scenarios/custom-html-test.ts +++ b/test-scenarios/custom-html-test.ts @@ -163,7 +163,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/customized-vendor-test.ts b/test-scenarios/customized-vendor-test.ts index ec3952cb7..d93ec8616 100644 --- a/test-scenarios/customized-vendor-test.ts +++ b/test-scenarios/customized-vendor-test.ts @@ -139,7 +139,7 @@ appScenarios app = await scenario.prepare(); }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/doubly-indirect-test.ts b/test-scenarios/doubly-indirect-test.ts index 8f81db7a8..3d6f16df0 100644 --- a/test-scenarios/doubly-indirect-test.ts +++ b/test-scenarios/doubly-indirect-test.ts @@ -165,7 +165,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/dynamic-import-test.ts b/test-scenarios/dynamic-import-test.ts index 4659f922f..a5921f6b2 100644 --- a/test-scenarios/dynamic-import-test.ts +++ b/test-scenarios/dynamic-import-test.ts @@ -263,7 +263,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); diff --git a/test-scenarios/ember-cli-typescript-2-test.ts b/test-scenarios/ember-cli-typescript-2-test.ts index b109c5c39..38554a2b8 100644 --- a/test-scenarios/ember-cli-typescript-2-test.ts +++ b/test-scenarios/ember-cli-typescript-2-test.ts @@ -56,7 +56,7 @@ appScenarios app = await scenario.prepare(); }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/ember-cli-typescript-3-test.ts b/test-scenarios/ember-cli-typescript-3-test.ts index 8e3ffbc6a..6345ad383 100644 --- a/test-scenarios/ember-cli-typescript-3-test.ts +++ b/test-scenarios/ember-cli-typescript-3-test.ts @@ -70,7 +70,7 @@ appScenarios app = await scenario.prepare(); }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/ember-cli-typescript-4-test.ts b/test-scenarios/ember-cli-typescript-4-test.ts index 6fed089f2..7ece7f000 100644 --- a/test-scenarios/ember-cli-typescript-4-test.ts +++ b/test-scenarios/ember-cli-typescript-4-test.ts @@ -49,7 +49,7 @@ appScenarios app = await scenario.prepare(); }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/fastboot-helper.ts b/test-scenarios/fastboot-helper.ts index 94b8f2f37..6ed903cab 100644 --- a/test-scenarios/fastboot-helper.ts +++ b/test-scenarios/fastboot-helper.ts @@ -4,7 +4,7 @@ import resolve from 'resolve'; import { realpathSync } from 'fs'; export async function setupFastboot(app: PreparedApp, environment = 'development') { - let result = await app.execute(`volta run ember -- build --environment=${environment}`); + let result = await app.execute(`volta run ember build --environment=${environment}`); if (result.exitCode !== 0) { throw new Error(`failed to build app for fastboot: ${result.output}`); } diff --git a/test-scenarios/import-sync-test.ts b/test-scenarios/import-sync-test.ts index 25109b51b..a6def5730 100644 --- a/test-scenarios/import-sync-test.ts +++ b/test-scenarios/import-sync-test.ts @@ -83,12 +83,13 @@ appScenarios return { message: err.message } } }, - });` + });`, }, }, tests: { acceptance: { - 'import-sync-test.js': ` + 'import-sync-test.js': + ` import { module, test } from 'qunit'; import { visit, currentURL } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; @@ -146,7 +147,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); diff --git a/test-scenarios/indirect-test.ts b/test-scenarios/indirect-test.ts index 883c8d74b..e12aa8fdd 100644 --- a/test-scenarios/indirect-test.ts +++ b/test-scenarios/indirect-test.ts @@ -203,7 +203,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); @@ -248,7 +248,7 @@ Scenarios.fromProject(baseApp) }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/layering-test.ts b/test-scenarios/layering-test.ts index b1777a1f8..c73aea403 100644 --- a/test-scenarios/layering-test.ts +++ b/test-scenarios/layering-test.ts @@ -72,7 +72,7 @@ appScenarios }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/leader-test.ts b/test-scenarios/leader-test.ts index 7c229b429..f531e89e2 100644 --- a/test-scenarios/leader-test.ts +++ b/test-scenarios/leader-test.ts @@ -72,7 +72,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('run tests', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); @@ -98,7 +98,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('ensure error', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.notEqual(result.exitCode, 0, result.output); assert.ok( /To use these addons, your app needs ember-auto-import >= 2: .*other-problematic-addon.*problematic-addon/.test( @@ -128,7 +128,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('ensure error', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.notEqual(result.exitCode, 0, result.output); assert.ok( /To use these addons, your app needs ember-auto-import >= 2: .*other-problematic-addon.*problematic-addon/.test( diff --git a/test-scenarios/merged-test.ts b/test-scenarios/merged-test.ts index 92ee0fb4f..b640b426e 100644 --- a/test-scenarios/merged-test.ts +++ b/test-scenarios/merged-test.ts @@ -226,7 +226,7 @@ appScenarios app = await scenario.prepare(); }); test('ensure build succeeds', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/no-conflict-test.ts b/test-scenarios/no-conflict-test.ts index 87aca45f9..b80860cfb 100644 --- a/test-scenarios/no-conflict-test.ts +++ b/test-scenarios/no-conflict-test.ts @@ -43,7 +43,7 @@ appScenarios app = await scenario.prepare(); }); test('ensure build succeeds', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/node-es-modules.ts b/test-scenarios/node-es-modules.ts index 4afc72e3b..09699997f 100644 --- a/test-scenarios/node-es-modules.ts +++ b/test-scenarios/node-es-modules.ts @@ -37,7 +37,7 @@ template }); test('npm run test', async function (assert) { console.log(app.dir); - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/sample-addon-test.ts b/test-scenarios/sample-addon-test.ts index 3493078f8..a4de0fa3a 100644 --- a/test-scenarios/sample-addon-test.ts +++ b/test-scenarios/sample-addon-test.ts @@ -220,7 +220,7 @@ addonScenarios app = await scenario.prepare(); }); test('yarn test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/static-import-test.ts b/test-scenarios/static-import-test.ts index 4a067ed17..732637eff 100644 --- a/test-scenarios/static-import-test.ts +++ b/test-scenarios/static-import-test.ts @@ -216,7 +216,7 @@ function staticImportTest(project: Project) { let txt = await loadTxt(); assert.equal(txt, 'here is some text'); }); - }); + }); `, 'import-into-tests-test.js': ` import { module, test } from 'qunit'; @@ -397,7 +397,7 @@ scenarios.forEachScenario(scenario => { }); test('npm run test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/targets-test.ts b/test-scenarios/targets-test.ts index 9fdb77ae9..b554a6a8d 100644 --- a/test-scenarios/targets-test.ts +++ b/test-scenarios/targets-test.ts @@ -124,7 +124,7 @@ appScenarios app = await scenario.prepare(); }); test('yarn test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/v2-addon-test.ts b/test-scenarios/v2-addon-test.ts index 79753eb10..4ba142e6b 100644 --- a/test-scenarios/v2-addon-test.ts +++ b/test-scenarios/v2-addon-test.ts @@ -387,7 +387,7 @@ scenarios.forEachScenario(scenario => { app = await scenario.prepare(); }); test('yarn test', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); @@ -454,7 +454,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('ensure error', async function (assert) { - let result = await app.execute('volta run npm -- run build'); + let result = await app.execute('volta run npm run build'); assert.notEqual(result.exitCode, 0, result.output); assert.ok( /my-v1-addon needs to depend on ember-auto-import in order to use my-v2-addon/.test(result.stderr), @@ -528,7 +528,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('ensure success', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.strictEqual(result.exitCode, 0, result.output); }); }); diff --git a/test-scenarios/webpack-config-test.ts b/test-scenarios/webpack-config-test.ts index 9ad10c349..dfc0efe1c 100644 --- a/test-scenarios/webpack-config-test.ts +++ b/test-scenarios/webpack-config-test.ts @@ -112,7 +112,7 @@ Scenarios.fromProject(baseApp) app = await scenario.prepare(); }); test('ensure build succeeds', async function (assert) { - let result = await app.execute('volta run npm -- run test'); + let result = await app.execute('volta run npm run test'); assert.equal(result.exitCode, 0, result.output); }); }); From f82d7b73cf337d9aad1446c0acacb4add72cd599 Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Mon, 9 Sep 2024 11:59:14 +0200 Subject: [PATCH 3/3] Use colocated format for test component --- test-scenarios/static-import-test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test-scenarios/static-import-test.ts b/test-scenarios/static-import-test.ts index 732637eff..0c7fe83c4 100644 --- a/test-scenarios/static-import-test.ts +++ b/test-scenarios/static-import-test.ts @@ -116,6 +116,12 @@ function staticImportTest(project: Project) { }), }); `, + 'hello-world.hbs': ` +
{{this.formattedDate}}
+
{{#if this.lodashPresent}}yes{{else}}no{{/if}}
+
{{this.aliasedResult}}
+
{{this.fromScoped}}
+ `, }, lib: { 'example1.js': 'export default function() { return "example1 worked" }', @@ -151,6 +157,7 @@ function staticImportTest(project: Project) { templates: { 'application.hbs': `{{hello-world}}`, components: { + // Our "lts" scenario runs a very old version of Ember that does not support colocated components, that's why we intentionally keep this here 'hello-world.hbs': `
{{this.formattedDate}}
{{#if this.lodashPresent}}yes{{else}}no{{/if}}