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

ES5 target support + Angular 10 Support #158

Closed
icorne opened this issue Jul 10, 2020 · 5 comments · Fixed by #161
Closed

ES5 target support + Angular 10 Support #158

icorne opened this issue Jul 10, 2020 · 5 comments · Fixed by #161
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@icorne
Copy link

icorne commented Jul 10, 2020

Hello,

This is the only library I encountered thus far that does not support ES5 target anymore..
Could it be because in https://github.com/satanTime/ng-mocks/blob/83debd26ac89ed5ae5efb3c9be8ce7ad91ad6c64/e2e/a10es2015ivy/.browserslistrc you excluded IE11?

Can we try and revisit this?

@satanTime
Copy link
Member

satanTime commented Jul 10, 2020

Hi,

the lib does support es5, but angular 10 doesn't support it and always uses es2015 version of an imported lib.

I spent around 2 weeks to determine a solution and failed with every idea.

Feel free to try to fix it yourself, perhaps you'll find a working solution.

The link you provided is E2E test, there's a version for es5 too: https://github.com/satanTime/ng-mocks/blob/83debd26ac89ed5ae5efb3c9be8ce7ad91ad6c64/e2e/a10es5ivy/.browserslistrc

@icorne
Copy link
Author

icorne commented Jul 10, 2020

I can have a look when I find some time.
Where did you find that angular 10 does not support ES5 target?
We've got a pretty extensive app (hybrid with angularjs even) and everything is working except my tests which use ng-mocks.

@satanTime
Copy link
Member

During investigation, starting from angular 10 it ignores es5 build even it has been provided: https://github.com/ike18t/ng-mocks/blob/master/package.json#L5-L8.

I think in your app dependencies don't extend code base built by es5 and es2015, in case of ng-mocks if a component was built as es2015 and ng-mocks was built as es5 then it throws an error that an instance can't be created without using new operator that is required in es2015. Because es2015 is more popular it is the default build target.

Perhaps there's a way to downgrade to es5 not only the app itself, but also installed dependencies.

Current solution is to change tsconfig.spec.ts to use es2015.

@satanTime
Copy link
Member

Note: As an option to try: eval with detection of es6 classes.

@satanTime
Copy link
Member

Hi, might you check that #161 works for you on es5?

satanTime referenced this issue in satanTime/ng-mocks Jul 10, 2020
satanTime referenced this issue in satanTime/ng-mocks Jul 11, 2020
@satanTime satanTime self-assigned this Jul 11, 2020
@satanTime satanTime added the enhancement New feature or request label Jul 11, 2020
@satanTime satanTime added this to the v10.0.1 milestone Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants