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

Exclude spec files from AoT #2758

Merged
merged 1 commit into from
Nov 10, 2016
Merged

Exclude spec files from AoT #2758

merged 1 commit into from
Nov 10, 2016

Conversation

antonybudianto
Copy link
Contributor

fix #2736

@@ -88,7 +88,8 @@ export class AotPlugin {
}

const tsConfig = tsc.readConfiguration(options.tsConfigPath, basePath);
this._rootFilePath = tsConfig.parsed.fileNames;
this._rootFilePath = tsConfig.parsed.fileNames
.filter(fileName => fileName.indexOf('.spec.ts') < 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

to be 100% sure: .filter(fileName => fileName.match(/.spec.ts$/) === null); ? :)

Copy link
Contributor Author

@antonybudianto antonybudianto Oct 18, 2016

Choose a reason for hiding this comment

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

i like/\.spec\.ts$/.test(fileName) better since it returns boolean directly

@filipesilva
Copy link
Contributor

Tests were failing but it wasn't related to this PR, and fixed in #2832.

While I understand that this fix works, it shouldn't be necessary because of https://github.com/angular/angular-cli/blob/master/packages/angular-cli/models/webpack-build-typescript.ts#L57. Spec files shouldn't even be included. @hansl can you have a look?

@antonybudianto
Copy link
Contributor Author

antonybudianto commented Oct 23, 2016

@filipesilva , https://github.com/angular/angular-cli/blob/master/packages/angular-cli/models/webpack-build-typescript.ts#L57 does exclude the file from what module will imports, but not from ngc/tsc, since in fact the spec files still get compiled by ngc (you can log the fileNames there and find out the spec files still get listed and then compiled)

@antonybudianto
Copy link
Contributor Author

@filipesilva @hansl , any updates on this?

@hansl
Copy link
Contributor

hansl commented Nov 10, 2016

LGTM.

@hansl hansl merged commit 215e555 into angular:master Nov 10, 2016
@antonybudianto antonybudianto deleted the patch-1 branch November 10, 2016 23:46
@antonybudianto
Copy link
Contributor Author

Thank you @hansl @filipesilva

@ptomaszi
Copy link

When can we have that fix available through NPM?

@antonybudianto
Copy link
Contributor Author

@ptomaszi It's on npm since beta 20-1

MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this pull request Feb 9, 2017
@BrainCrumbz
Copy link

BrainCrumbz commented Mar 2, 2017

@antonybudianto somehow off-topic, but how can one "log the fileNames" that get compiled by ngc? Thanks

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AoT still compile spec files
7 participants