Skip to content

Commit

Permalink
Relax TS version requirement to include older versions
Browse files Browse the repository at this point in the history
This tests with TS 4.1, and Rollup 2.55, which are the lowest versions
that work without too much snapshot changes.
(Rollup could probably go lower, but they changed from `export default Foo` to `export { Foo as default }`)

fixes #176
  • Loading branch information
Swatinem committed Dec 24, 2021
1 parent a49d279 commit d24faac
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ jobs:
timeout-minutes: 1
continue-on-error: true
run: bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_TOKEN}} -B ${{ github.ref }} -f coverage/coverage-final.json
# test the minimum supported peer dependency version
- run: npm install [email protected] [email protected]
# aka `npm test` without the `pretest/build`
- run: node .build/tests/index.js
67 changes: 36 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
"@types/d3-drag": "^3.0.1",
"@types/estree": "0.0.50",
"@types/fs-extra": "^9.0.13",
"@types/node": "^16.11.10",
"@types/react": "^17.0.37",
"@types/node": "^17.0.4",
"@types/react": "^17.0.38",
"c8": "^7.10.0",
"fs-extra": "^10.0.0",
"rimraf": "^3.0.2",
"rollup": "2.60.1",
"typescript": "4.5.2"
"rollup": "2.62.0",
"typescript": "4.5.4"
},
"peerDependencies": {
"rollup": "^2.60.1",
"typescript": "^4.5.2"
"rollup": "^2.55",
"typescript": "~4.1 || ~4.2 || ~4.3 || ~4.4 || ~4.5"
},
"optionalDependencies": {
"@babel/code-frame": "^7.16.0"
Expand Down
11 changes: 11 additions & 0 deletions tests/testcases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from "assert";
import fsExtra from "fs-extra";
import * as path from "path";
import { InputOption, InputOptions, rollup, RollupOptions, RollupOutput } from "rollup";
import ts from "typescript";
import dts, { Options } from "../src/index.js";
import { forEachFixture, Harness } from "./utils.js";

Expand All @@ -21,6 +22,15 @@ export default (t: Harness) => {
meta.rollupOptions = Object.assign(rollupOptions, meta.rollupOptions);
} catch {}

if (meta.tsVersion) {
const [major, minor] = ts.versionMajorMinor.split(".").map(Number);
const [reqMajor, reqMinor] = meta.tsVersion.split(".").map(Number);
if (major! < reqMajor! || minor! < reqMinor!) {
// skip unsupported version
return;
}
}

if (!meta.skip) {
return assertTestcase(dir, meta, bless);
}
Expand All @@ -33,6 +43,7 @@ interface Meta {
rollupOptions: RollupOptions;
skip: boolean;
expectedError?: string;
tsVersion?: string;
}

async function createBundle(options: Options, rollupOptions: RollupOptions) {
Expand Down
3 changes: 3 additions & 0 deletions tests/testcases/ts42-abstract/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
tsVersion: "4.2",
};
3 changes: 3 additions & 0 deletions tests/testcases/ts43-getset/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
tsVersion: "4.2",
};

0 comments on commit d24faac

Please sign in to comment.