Skip to content

Commit

Permalink
Properly use @embroider/test-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Apr 11, 2022
1 parent 62c2b93 commit d38bb7e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 57 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -52,6 +52,7 @@ jobs:
- ember-classic
- ember-default-with-jquery
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2
Expand Down
48 changes: 3 additions & 45 deletions config/ember-try.js
@@ -1,36 +1,7 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
const EMBROIDER_VERSION = '^0.43.4';
const embroider = {
safe: {
name: 'embroider-safe',
npm: {
devDependencies: {
'@embroider/core': EMBROIDER_VERSION,
'@embroider/webpack': EMBROIDER_VERSION,
'@embroider/compat': EMBROIDER_VERSION,
},
},
env: {
EMBROIDER_TEST_SETUP_OPTIONS: 'safe',
},
},

optimized: {
name: 'embroider-optimized',
npm: {
devDependencies: {
'@embroider/core': EMBROIDER_VERSION,
'@embroider/webpack': EMBROIDER_VERSION,
'@embroider/compat': EMBROIDER_VERSION,
},
},
env: {
EMBROIDER_TEST_SETUP_OPTIONS: 'optimized',
},
},
};
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
Expand Down Expand Up @@ -145,21 +116,8 @@ module.exports = async function () {
devDependencies: {},
},
},
embroider.safe,
// disable embroider optimized test scenarios, as the dynamism these
// tests use is not compatible with embroider we are still exploring
// appropriate paths forward.
//
// Steps to re-enable:
//
// 1. have a strategy to make this work
// 2. uncomment the next line
// embroider.optimized,
//
// 3. add "embroider-optimized" to .github/workflows/ci-build.yml's
// ember-try-scenario list.
//
// embroiderOptimized(), disabled because of: https://github.com/embroider-build/embroider/issues/522
embroiderSafe(),
embroiderOptimized(),
],
};
};
32 changes: 20 additions & 12 deletions ember-cli-build.js
Expand Up @@ -10,16 +10,24 @@ module.exports = function (defaults) {
},
});

try {
const { maybeEmbroider } = require('@embroider/test-setup'); // eslint-disable-line node/no-missing-require
return maybeEmbroider(app);
} catch (e) {
// This exists, so that we can continue to support node 10 for some of our
// test scenarios. Specifically those not scenario testing embroider. As
// @embroider/test-setup and @embroider in no longer supports node 10
if (e !== null && typeof e === 'object' && e.code === 'MODULE_NOT_FOUND') {
return app.toTree();
}
throw e;
}
const { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
packageRules: [
{
// See: https://github.com/embroider-build/embroider/issues/522
package: 'dummy',
components: {
'{{template-only}}': {
safeToIgnore: true,
},
'{{js-only}}': {
safeToIgnore: true,
},
'{{jax}}': {
safeToIgnore: true,
},
},
},
],
});
};
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -44,6 +44,7 @@
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.4.2",
"@embroider/test-setup": "^1.0.0",
"babel-eslint": "^10.1.0",
"ember-angle-bracket-invocation-polyfill": "^3.0.1",
"ember-cli": "~3.27.0",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Expand Up @@ -1048,6 +1048,14 @@
semver "^7.3.5"
typescript-memoize "^1.0.1"

"@embroider/test-setup@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-1.0.0.tgz#f0841345326bcb55eee8437be37f3a8207146b37"
integrity sha512-jnrzNyL0mUZ+DTY59s4Yr/V+NgECpwKxuxdKJOr0hNCxC6Kpo5Dagjz22tEyiMOkZhuDdZ4qAqmTUpeu8taLnQ==
dependencies:
lodash "^4.17.21"
resolve "^1.20.0"

"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
Expand Down

0 comments on commit d38bb7e

Please sign in to comment.