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

Failure reproduction: add test for @ember/string @ 4 #2068

Closed
wants to merge 2 commits into from
Closed
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
44 changes: 41 additions & 3 deletions pnpm-lock.yaml

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

3 changes: 3 additions & 0 deletions tests/scenarios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@babel/runtime": "^7.18.6",
"@ember/legacy-built-in-components": "^0.4.1",
"@ember/string": "^3.0.0",
"@ember/string-4": "npm:@ember/string@^4.0.0",
"@ember/test-helpers-3": "npm:@ember/test-helpers@^3.2.0",
"@ember/test-waiters": "^3.0.2",
"@embroider/addon-shim": "workspace:*",
Expand All @@ -69,6 +70,7 @@
"ember-cli-4.8": "npm:ember-cli@~4.8.0",
"ember-cli-5.4": "npm:ember-cli@~5.4.0",
"ember-cli-5.8": "npm:ember-cli@~5.8.0",
"ember-cli-app-version-7": "npm:ember-cli-app-version@^7.0.0",
"ember-cli-babel-latest": "npm:ember-cli-babel@latest",
"ember-cli-beta": "npm:ember-cli@beta",
"ember-cli-fastboot": "^4.1.1",
Expand All @@ -84,6 +86,7 @@
"ember-inline-svg": "^0.2.1",
"ember-modifier": "^4.0.0",
"ember-qunit-7": "npm:ember-qunit@^7.0.0",
"ember-resolver-12": "npm:ember-resolver@^12.0.1",
"ember-source": "~3.28.11",
"ember-source-4.12": "npm:ember-source@~4.12.0",
"ember-source-4.4": "npm:ember-source@~4.4.0",
Expand Down
100 changes: 100 additions & 0 deletions tests/scenarios/static-app-former-implict-addons-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { appScenarios } from './scenarios';
import type { PreparedApp } from 'scenario-tester';
import QUnit from 'qunit';
import merge from 'lodash/merge';
const { module: Qmodule, test } = QUnit;

// this test is being used as a "smoke test" to check the widest possible support matrix
appScenarios
.only('release')
.map('static-app-former-implicit-addons', project => {
project.linkDevDependency('bootstrap', { baseDir: __dirname });
project.linkDevDependency('@embroider/macros', { baseDir: __dirname });
project.linkDevDependency('ember-modifier', { baseDir: __dirname });
project.linkDevDependency('@ember/string', { baseDir: __dirname, resolveName: '@ember/string-4' });
project.linkDevDependency('ember-resolver', { baseDir: __dirname, resolveName: 'ember-resolver-12' });
project.linkDevDependency('ember-cli-app-version', { baseDir: __dirname, resolveName: 'ember-cli-app-version-7' });

merge(project.files, {
app: {
components: {
'box.js': `
import Component from '@glimmer/component';
import { camelize } from '@ember/string';

export default class FancyBox extends Component {
get camelizedTitle() {
return camelize(this.args.title);
}
}
`,
'box.hbs': `{{this.camelizedTitle}}`,
},
},
tests: {
integration: {
components: {
'box-test.js': `
import { module, test } from 'qunit';
import { setupRenderingTest } from 'app-template/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Rendering | <Box />', function (hooks) {
setupRenderingTest(hooks);

test('it renders', async function (assert) {
await render(hbs('<Box @title="i-want-to-be-camel-case" />'));
assert.dom().containsText('iWantToBeCamelCase');
});
});`,
},
},
},
'ember-cli-build.js': `
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { MacrosConfig } = require('@embroider/macros/src/node');

module.exports = function (defaults) {
let app = new EmberApp(defaults, {
});

MacrosConfig.for(app).setOwnConfig(__filename, {
isClassic: Boolean(process.env.CLASSIC),
});

if (process.env.CLASSIC) {
return app.toTree();
}

const { compatBuild, recommendedOptions } = require('@embroider/compat');

const Webpack = require('@embroider/webpack').Webpack;
return compatBuild(app, Webpack, {
...recommendedOptions.optimized,
skipBabel: [
{ package: 'qunit' },
{ package: 'macro-decorators' },
],
});
};
`,
});
})
.forEachScenario(scenario => {
Qmodule(scenario.name, function (hooks) {
let app: PreparedApp;
hooks.before(async () => {
app = await scenario.prepare();
});

['production', 'development'].forEach(env => {
test(`pnpm test: ${env}`, async function (assert) {
let result = await app.execute(`cross-env EMBER_ENV=${env} pnpm test`);
assert.equal(result.exitCode, 0, result.output);
});
});
});
});