Skip to content

test(compiler-cli): add tests for supported TS versions - #22701

Closed
benbraou wants to merge 1 commit into
angular:masterfrom
benbraou:issue22699
Closed

benbraou wants to merge 1 commit into
angular:masterfrom
benbraou:issue22699

Conversation

@benbraou

Copy link
Copy Markdown
Contributor

Fixes #22699

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] angular.io application / infrastructure changes
[x] Other... Please describe: new unit tests

What is the current behavior?

No tests for supported TypeScript versions/ disableTypeScriptVersionCheck angularCompilerOptions flag

Issue Number: N/A
#22699

What is the new behavior?

new tests added

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

recoverRealTsVersion();
});

function dangerouslySetTsVersion(version: string) { (ts as any).version = version; }

@benbraou benbraou Mar 11, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Instead of changing the version of TypeScript, another approach is to just export a function from program.ts

export function checkTypeScriptVersion(version: string, options: CompilerOptions){
    if (version < '2.4.2' || (version >= '2.7.0' && !options.disableTypeScriptVersionCheck)) {
      throw new Error(
          `The Angular Compiler requires TypeScript >=2.4.2 and <2.7 but ${version} was found instead.`);
    }
}

And then perform assertions on it.
#22699 is however talking just about adding tests and not modifying the source file. Hence dangerouslySetTsVersion in the test file.
Please let me know if I need to change this

@benbraou

Copy link
Copy Markdown
Contributor Author

In order not to waste a reviewer time, please note that this PR (as well as the associated issue) may be closed depending on the outcome of the ongoing PR #22705 (it does small refactoring of progam.ts and adds equivalent tests to this PR)

@kara kara added the area: core Issues related to the framework runtime label Mar 14, 2018
@benbraou

Copy link
Copy Markdown
Contributor Author

I am closing this PR as my changes in #22705 are merged in master now. They already add tests to TypeScript version check

@benbraou benbraou closed this Mar 30, 2018
@benbraou
benbraou deleted the issue22699 branch March 30, 2018 17:20
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: core Issues related to the framework runtime cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no tests for disableTypeScriptVersionCheck angularCompilerOptions flag

3 participants