Skip to content

Commit 8b1545b

Browse files
committed
Add EmberENV.LOG_INSPECTOR_HINT flag
Gates the "install the Ember Inspector" hint logged on window.load. This allows to skip it e.g. in test/CI runs. Default: true (no behavior change) `EmberENV.LOG_INSPECTOR_HINT = false` to silence. This one is more difficult to test than `LOG_VERSION` since it runs at module load. I did confirm locally that this ~oneliner works.
1 parent fe71b80 commit 8b1545b

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

packages/@ember/-internals/environment/lib/env.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ export const ENV = {
5656
*/
5757
LOG_VERSION: true,
5858

59+
/**
60+
The `LOG_INSPECTOR_HINT` property, when true, tells Ember to log a hint
61+
suggesting the Ember Inspector browser extension when it is not detected.
62+
63+
@property LOG_INSPECTOR_HINT
64+
@type Boolean
65+
@default true
66+
@for EmberENV
67+
@public
68+
*/
69+
LOG_INSPECTOR_HINT: true,
70+
5971
RAISE_ON_DEPRECATION: false,
6072

6173
STRUCTURED_PROFILE: false,

packages/@ember/debug/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isChrome, isFirefox } from '@ember/-internals/browser-environment';
2+
import { ENV } from '@ember/-internals/environment';
23
import type { AnyFn } from '@ember/-internals/utility-types';
34
import { DEBUG } from '@glimmer/env';
45
import type { DeprecateFunc, DeprecationOptions } from './lib/deprecate';
@@ -273,7 +274,7 @@ if (DEBUG) {
273274

274275
let _warnIfUsingStrippedFeatureFlags;
275276

276-
if (DEBUG && !isTesting()) {
277+
if (DEBUG && !isTesting() && ENV.LOG_INSPECTOR_HINT) {
277278
if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
278279
window.addEventListener(
279280
'load',

tests/docs/expected.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
'EXTEND_PROTOTYPES',
55
'GUID_KEY',
66
'GUID_PREFIX',
7+
'LOG_INSPECTOR_HINT',
78
'LOG_STACKTRACE_ON_DEPRECATION',
89
'LOG_VERSION',
910
'[]',

0 commit comments

Comments
 (0)