Skip to content

Instantly share code, notes, and snippets.

@bendemboski
Created May 18, 2021 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bendemboski/05d00b3f95e7ce8b720b22d161fa5d28 to your computer and use it in GitHub Desktop.
Save bendemboski/05d00b3f95e7ce8b720b22d161fa5d28 to your computer and use it in GitHub Desktop.
Webpack config to make ember-cli-page-object work with embroider optimized
module.exports = {
module: {
rules: [
// ember-cli-page-object's compatiblity module is a wrapper around
// @ember/test-helpers that synthesizes its methods using older APIs when
// in an app with an old/missing version of @ember/test-helpers. The
// dynamic-ness disagrees with embroider's staticAddonTestSupportTrees
// flag, so since we know we will only run in environments with a
// sufficiently new @ember/test-helpers, string-replace the compatiblity
// module to statically re-export @ember/test-helpers, and also to export
// the named wait helper, which was an older name for settled() (and will
// never actually be called anyway).
{
test: /\/ember-cli-page-object\/test-support\/-private\/compatibility\.js$/,
loader: 'string-replace-loader',
options: {
search: /^[\s\S]+$/,
replace: [
"export * from '@ember/test-helpers';",
"export { settled as wait } from '@ember/test-helpers';",
].join('\n'),
strict: true,
},
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment