ember-cli / ember-cli/ember-app-blueprint

Setting `isTesting = true` in `enterTestMode()` is too late

Open
#175 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9
Forks
16
Avg merge
1d 2h
Merged PRs (30d)
13

Description

Hello,

I'm playing with `--no-compat` mode, and found that current setup of `isTesting` macro is done too late.

Because `macroCondition(isTesting())` can be called _everywhere_ eq. app/add-on module's scope, it seems necessary to setup macros before any import of app/add-on code.

Using following example worked for me, does this make sense?

```html

window._embroider_macros_runtime_config ??= [];
window._embroider_macros_runtime_config.push((config) => {
config.getGlobalConfig()["@embroider/macros"].isTesting = true;
});

import { start } from './test-helper';
import.meta.glob("./**/*.{js,ts,gjs,gts}", { eager: true });
start();

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.