Skip to content

no tests for disableTypeScriptVersionCheck angularCompilerOptions flag #22699

Closed

Description

@IgorMinar

This code path has no tests:

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

We should add them.

This would be a great issue for a community contribution.

Activity

  1. added this to the needsTriage milestone on Mar 10, 2018
  2. modified the milestones: needsTriage, Backlog on Mar 29, 2018
  3. benbraou commented on Mar 30, 2018

    @benbraou
    Contributor

    @IgorMinar I believe this issue can be closed now.
    PR #22705 is merged in master now. It has added several tests, and among them tests for disableTypeScriptVersionCheck

    describe('checkVersion', () => {
    const MIN_TS_VERSION = '2.7.2';
    const MAX_TS_VERSION = '2.8.0';
    const versionError = (version: string) =>
    `The Angular Compiler requires TypeScript >=${MIN_TS_VERSION} and <${MAX_TS_VERSION} but ${version} was found instead.`;
    it('should not throw when a supported TypeScript version is used', () => {
    expect(() => checkVersion('2.7.2', MIN_TS_VERSION, MAX_TS_VERSION, undefined)).not.toThrow();
    expect(() => checkVersion('2.7.2', MIN_TS_VERSION, MAX_TS_VERSION, false)).not.toThrow();
    expect(() => checkVersion('2.7.2', MIN_TS_VERSION, MAX_TS_VERSION, true)).not.toThrow();
    });
    it('should handle a TypeScript version < the minimum supported one', () => {
    expect(() => checkVersion('2.4.1', MIN_TS_VERSION, MAX_TS_VERSION, undefined))
    .toThrowError(versionError('2.4.1'));
    expect(() => checkVersion('2.4.1', MIN_TS_VERSION, MAX_TS_VERSION, false))
    .toThrowError(versionError('2.4.1'));
    expect(() => checkVersion('2.4.1', MIN_TS_VERSION, MAX_TS_VERSION, true)).not.toThrow();
    });
    it('should handle a TypeScript version > the maximum supported one', () => {
    expect(() => checkVersion('2.9.0', MIN_TS_VERSION, MAX_TS_VERSION, undefined))
    .toThrowError(versionError('2.9.0'));
    expect(() => checkVersion('2.9.0', MIN_TS_VERSION, MAX_TS_VERSION, false))
    .toThrowError(versionError('2.9.0'));
    expect(() => checkVersion('2.9.0', MIN_TS_VERSION, MAX_TS_VERSION, true)).not.toThrow();
    });
    });

  4. added
    area: compilerIssues related to `ngc`, Angular's template compiler
    and removed
    area: coreIssues related to the framework runtime
    on Mar 14, 2020
  5. pkozlowski-opensource commented on Mar 14, 2020

    @pkozlowski-opensource
    Member

    Sounds like it was fixed: #22699 (comment)

  6. angular-automatic-lock-bot commented on Apr 14, 2020

    @angular-automatic-lock-bot

    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.

  7. locked and limited conversation to collaborators on Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions