Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): correctly check for typeof of undefined in ngDevMode check #47480

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/util/is_dev_mode.ts
Expand Up @@ -49,7 +49,7 @@ export function enableProdMode(): void {

// The below check is there so when ngDevMode is set via terser
// `global['ngDevMode'] = false;` is also dropped.
if (typeof ngDevMode === undefined || !!ngDevMode) {
if (typeof ngDevMode === 'undefined' || ngDevMode) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha ha - indeed!

can you think of a test that would expose this situation so we don't regress in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling enableProdMode leaks to other tests. Because at the moment we cannot reset _devMode after the enableProdMode test.

As such, probably I will have to remove the test.

global['ngDevMode'] = false;
}

Expand Down