diff --git a/lean4-infoview/package.json b/lean4-infoview/package.json index 20f9e5a97..c889009fa 100644 --- a/lean4-infoview/package.json +++ b/lean4-infoview/package.json @@ -6,7 +6,7 @@ "watch": "rollup --config --environment NODE_ENV:development --watch", "build": "rollup --config --environment NODE_ENV:production", "watchTest": "npm run watch", - "test": "tsc -p test/tsconfig.json" + "test": "test/run-tests.sh" }, "exports": { ".": "./dist/index.development.js", diff --git a/lean4-infoview/test/run-tests.sh b/lean4-infoview/test/run-tests.sh new file mode 100755 index 000000000..66dabc176 --- /dev/null +++ b/lean4-infoview/test/run-tests.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +PUBLISHED_VERSION="$(npm view @leanprover/infoview-api version --no-workspaces)" +NEW_VERSION="$(sed -n 's/^\s*"version":\s*"\(.*\)",\s*/\1/p' ./package.json)" +PUBLISHED_MAJOR="$(cut -d '.' -f 1 <<< $PUBLISHED_VERSION)" +NEW_MAJOR="$(cut -d '.' -f 1 <<< $NEW_VERSION)" + +if [ $PUBLISHED_MAJOR == $NEW_MAJOR ]; then + tsc -p test/tsconfig.json +else + echo "Skipping breaking.ts test as major version got bumped from $PUBLISHED_MAJOR to $NEW_MAJOR!" + tsc -p test/tsconfig-breaking.json +fi + +# exit if the above command failed +if [ $? -ne 0 ]; then + exit 1 +fi diff --git a/lean4-infoview/test/tsconfig-breaking.json b/lean4-infoview/test/tsconfig-breaking.json new file mode 100644 index 000000000..5f0d695c0 --- /dev/null +++ b/lean4-infoview/test/tsconfig-breaking.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig", + "compilerOptions": { + "rootDir": "../" + }, + "include": ["./**/*", "../src/**/*"], + "exclude": ["./breaking.ts"] +}