Skip to content

Commit

Permalink
fix(typescript-checker): support prerelease TypeScript versions (#4738)
Browse files Browse the repository at this point in the history
  • Loading branch information
davecardwell authored Feb 18, 2024
1 parent 9535075 commit 40ace6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/typescript-checker/src/tsconfig-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const LOW_EMIT_OPTIONS_FOR_PROJECT_REFERENCES: Readonly<Partial<ts.CompilerOptio
});

export function guardTSVersion(version = ts.version): void {
if (!semver.satisfies(version, '>=3.6')) {
if (!semver.satisfies(version, '>=3.6', { includePrerelease: true })) {
throw new Error(`@stryker-mutator/typescript-checker only supports typescript@3.6 or higher. Found typescript@${version}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,20 @@ describe('typescript-helpers', () => {
'@stryker-mutator/typescript-checker only supports typescript@3.6 or higher. Found typescript@3.5.0',
);
});
it('should throw if typescript@3.5.0-beta', () => {
expect(guardTSVersion.bind(undefined, '3.5.0-beta')).throws(
'@stryker-mutator/typescript-checker only supports typescript@3.6 or higher. Found typescript@3.5.0-beta',
);
});
it('should not throw if typescript@3.6.0', () => {
expect(guardTSVersion.bind(undefined, '3.6.0')).not.throws();
});
it('should not throw if typescript@4.0.0', () => {
expect(guardTSVersion.bind(undefined, '4.0.0')).not.throws();
});
it('should not throw if typescript@5.4.0-beta', () => {
expect(guardTSVersion.bind(undefined, '5.4.0-beta')).not.throws();
});
});

describe(getSourceMappingURL.name, () => {
Expand Down

0 comments on commit 40ace6e

Please sign in to comment.