From 937e45b07a7df40688505fea5158e2830578945c Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Wed, 6 Apr 2022 11:32:42 +0100 Subject: [PATCH] make sure that config is from the test envrionment when running /tests --- addon/index.js | 12 ++++++++++-- index.js | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addon/index.js b/addon/index.js index fab3cee..d96853b 100644 --- a/addon/index.js +++ b/addon/index.js @@ -1,3 +1,11 @@ -import { getOwnConfig } from '@embroider/macros'; +import { isTesting, macroCondition, getOwnConfig } from '@embroider/macros'; -export default getOwnConfig().config; +let config; + +if (macroCondition(isTesting())) { + config = getOwnConfig().testConfig; +} else { + config = getOwnConfig().config; +} + +export default config; diff --git a/index.js b/index.js index 920fc3c..292757b 100644 --- a/index.js +++ b/index.js @@ -27,8 +27,12 @@ module.exports = { included() { this._super.included.apply(this, arguments); + this.options['@embroider/macros'].setOwnConfig.config = findRoot( this ).project.config(process.env.EMBER_ENV); + + this.options['@embroider/macros'].setOwnConfig.testConfig = + findRoot(this).project.config('test'); }, };