-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Spec files in subdirs included in AOT compilation #3973
Comments
@mattdistefano can you try reproduce it on updated angular-cli? now it is |
Ah man you guys are killing me - just spent the afternoon upgrading from beta 23 to beta 24. But yeah I'll check. |
|
@antonybudianto7 It looks similar but this issue is specifically re. spec files in subdirectories. Also the errors we're seeing look different. |
@mattdistefano I used |
Can confirm this is present in beta 25.5 too: angular-cli: 1.0.0-beta.25.5 |
I think I was with the same issue, and after update to beta 25 it disappears. |
This is fixed at the moment but I know some older versions of the CLI were more lenient with the dependency versions. Make sure to follow the instructions in https://github.com/angular/angular-cli#updating-angular-cli, especially the bits where you delete your local node_modules. |
@filipesilva Are you saying this is fixed in beta 26? |
@mattdistefano probably even before that, but there might have been some old version of |
Gotcha. Alright, I'll try again. |
Hi, have got the same problem, i.e. one of my tests (.component.spec.ts) has an import to BrowserDynamicTestingModule in order to set the entryComponents property, and keeps failing with the error message mentioned above. The problem is still there with the current version (angular-cli: 1.0.0-beta.26).
|
@filipesilva I just confirmed this issue is still present in beta 26. See https://github.com/mattdistefano/ng-cli-beta26-spec-issue |
I think I might be running into this too. Things were working fine in beta.22-1 but upgrading to beta.26 started producing the exact error. It's still present with beta.30 and I haven't been able to figure out why test files are being loaded. Node_modules folder has been removed when upgrading each time. |
I have updated to cli 1.0.0-beta.32.3 and having the same issue too. |
Will investigate. |
Followed your repro and got this error:
|
The `karma` entry in `.angular-cli.json` now supports an `include` property, listing the test specific files to be included in the TypeScript compilation: ``` "test": { "karma": { "config": "./karma.conf.js" }, "include": [ "**/*.spec.ts", "test.ts" ] }, ``` Existing projects will default to the list abose. This list will also be used as an exclude list for AoT Compilations. Fix angular#3973
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Windows 10
Versions.
angular-cli: 1.0.0-beta.24
node: 6.9.1
os: win32 x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3
Repro steps.
ng init
a new app.src/app
and cd into itng g c test-comp
test-comp.component.spec.ts
file to includeimport { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
(This is somewhat arbitrary - I just know this particular module breaks AOT.)ng build -prod --aot
You'll get an error (see the log).
Note that if you do this directly under
src/app
you won't get an error, because the spec file is correctly excluded from the AOT build.I believe the culprit is here:
angular-cli/packages/@ngtools/webpack/src/plugin.ts
Line 124 in defc269
The single-star replacement looks like it's clobbering the previous double-star replacement so you go from
**/*\.spec\.ts
after line 120 to(?:.*)/*\.spec\.ts
after line 122 to(?:.(?:[^/]*))/(?:[^/]*)\.spec\.ts
after line 124, when you probably actually want(?:.*)/(?:[^/]*)\.spec\.ts
.The log given by the failure.
ERROR in Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in C:/wsecug it/ng-cli-beta-24/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in C:/wsecugit/ng-cli-beta-24/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in C:/wsecugit/n g-cli-beta-24/node_modules/@angular/platform-browser/testing/browser.d.ts
The text was updated successfully, but these errors were encountered: