From 9dee31ffdfcb92f78a8abf8254a92ed68fc0f230 Mon Sep 17 00:00:00 2001 From: MrChocolatine <47531779+MrChocolatine@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:02:29 +0000 Subject: [PATCH] build: disable Embroider adapter `ember-get-config` `ember-get-config`, latest version 0.5.0, doesn't support Embroider yet as this PR has not been merged as the time of writing this commit: https://github.com/mansona/ember-get-config/pull/29 In parallel, Embroider tests scenarios fail on our side: https://github.com/peopledoc/ember-feature-controls/actions/runs/1408588177 | `--> Relates to this issue: https://github.com/embroider-build/embroider/issues/823 This issue 823 recommends to use `require('@embroider/compat').compatBuild` in order to disable Embroider's adapter `ember-get-config` (see also https://github.com/embroider-build/embroider/tree/v0.47.1#options). But it does not work: `app` is not accepted by `compatBuild()` because it is an `EmberAddon`, not an `EmberApp`. Log from the error: ``` Argument of type 'EmberAddon' is not assignable to parameter of type 'EmberAppInstance'. Property 'testIndex' is missing in type 'EmberAddon' but required in type 'EmberAppInstance'.ts(2345) ``` However, the following document indicates we can pass these options to `maybeEmbroider()` to configure Embroider: https://github.com/embroider-build/embroider/tree/v0.47.1/packages/test-setup#maybeembroiderapp-embroideroptions References: - Embroider's adapter for `ember-get-config`: https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/compat-adapters/ember-get-config.ts - Embroider compatibility options: https://github.com/embroider-build/embroider/blob/v0.47.1/packages/compat/src/options.ts#L46-L61 - Discussions on Discord where I first saw the same initial issue: - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233 - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433 --- ember-cli-build.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ember-cli-build.js b/ember-cli-build.js index 3fdcd3e..eabe3f9 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,6 +1,7 @@ 'use strict' const EmberAddon = require('ember-cli/lib/broccoli/ember-addon') +const { maybeEmbroider } = require('@embroider/test-setup') module.exports = function (defaults) { let app = new EmberAddon(defaults, { @@ -15,12 +16,24 @@ module.exports = function (defaults) { */ app.import('node_modules/milligram/dist/milligram.css') - const { maybeEmbroider } = require('@embroider/test-setup') return maybeEmbroider(app, { skipBabel: [ { package: 'qunit', }, ], + + /** + * See: + * - https://github.com/embroider-build/embroider/issues/823 + * - https://discordapp.com/channels/480462759797063690/568935504288940056/901170716949512233 + * - https://discordapp.com/channels/480462759797063690/568935504288940056/902484167915364433 + * + * TODO: to remove once the following PR is released: + * https://github.com/mansona/ember-get-config/pull/29 + */ + compatAdapters: new Map([ + [ 'ember-get-config', null ] // eslint-disable-line prettier/prettier + ]), }) }