|
86 | 86 | - name: Build src
|
87 | 87 | run: npx hereby build-src
|
88 | 88 |
|
| 89 | + smoke: |
| 90 | + runs-on: ubuntu-latest |
| 91 | + |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v3 |
| 94 | + - uses: actions/setup-node@v3 |
| 95 | + with: |
| 96 | + node-version: "*" |
| 97 | + check-latest: true |
| 98 | + - run: npm ci |
| 99 | + |
| 100 | + - run: npx hereby lkg |
| 101 | + - run: | |
| 102 | + npm pack |
| 103 | + mv typescript*.tgz typescript.tgz |
| 104 | + echo "PACKAGE=$PWD/typescript.tgz" >> $GITHUB_ENV |
| 105 | +
|
| 106 | + - name: Smoke test |
| 107 | + run: | |
| 108 | + cd "$(mktemp -d)" |
| 109 | + npm init --yes |
| 110 | + npm install $PACKAGE tslib |
| 111 | +
|
| 112 | + npx tsc --version |
| 113 | + echo '{"seq": 1, "command": "status"}' | npx tsserver |
| 114 | +
|
| 115 | + cat > smoke.js << EOF |
| 116 | + const { __importDefault, __importStar } = require("tslib"); |
| 117 | + const ts = require(process.argv[2]); |
| 118 | +
|
| 119 | + // See: https://github.com/microsoft/TypeScript/pull/51474#issuecomment-1310871623 |
| 120 | + const fns = [ |
| 121 | + [() => ts.version, true], |
| 122 | + [() => ts.default.version, false], |
| 123 | + [() => __importDefault(ts).version, false], |
| 124 | + [() => __importDefault(ts).default.version, true], |
| 125 | + [() => __importStar(ts).version, true], |
| 126 | + [() => __importStar(ts).default.version, true], |
| 127 | + ]; |
| 128 | +
|
| 129 | + for (const [fn, shouldSucceed] of fns) { |
| 130 | + let success = false; |
| 131 | + try { |
| 132 | + success = !!fn(); |
| 133 | + } |
| 134 | + catch {} |
| 135 | + if (success !== shouldSucceed) { |
| 136 | + if (success) { |
| 137 | + console.error(`${fn.toString()} unexpectedly succeeded.`); |
| 138 | + } |
| 139 | + else { |
| 140 | + console.error(`${fn.toString()} did not succeed.`); |
| 141 | + } |
| 142 | + process.exitCode = 1; |
| 143 | + } |
| 144 | + } |
| 145 | + EOF |
| 146 | +
|
| 147 | + node ./smoke.js typescript |
| 148 | + node ./smoke.js typescript/lib/tsserverlibrary |
89 | 149 |
|
90 | 150 | misc:
|
91 | 151 | runs-on: ubuntu-latest
|
|
0 commit comments