Jest unit tests run in ivy mode
Unit tests run in non-ivy mode
import { 傻ivyEnabled as ivyEnabled } from '@angular/core';
public ngOnInit(): void {
console.log('> ivyEnabled', ivyEnabled);
}
false in consoleIt returns true in browser.
@nrwl/angular : 9.1.4
@nrwl/cli : 9.1.4
@nrwl/cypress : 9.1.4
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.1.4
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.1.4
@nrwl/web : Not Found
@nrwl/workspace : 9.1.4
typescript : 3.7.5
Running component's tests in non-ivy mode many stuff that are built with ivy support will not work and we have contradictions how component behave in browser and in tests.
E.x. regular task - unsubscribing on destroy via custom operator/decorator, like this library https://github.com/ngneat/until-destroy/. Currently it fails in tests on start
TypeError: Cannot read property 'onDestroy' of undefined
because is looking for ivy-related properties on component for proper work and has not found them.
Please take a look here: Cannot test @Injectable() services with Jest
Do you have this postinstall command:
ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
if so try changing it to just ngcc and try again.
Closing as resolved
@brandonroberts How is this solved? The default behavior seems broken, the _workaround_ isn't a fix. 馃槙 All unit tests are running in non-ivy mode with Jest.
Most helpful comment
@brandonroberts How is this solved? The default behavior seems broken, the _workaround_ isn't a fix. 馃槙 All unit tests are running in non-ivy mode with Jest.