( state: RunnerState, onChange: (state: RunnerState) => void, )
| 163 | } |
| 164 | |
| 165 | function subscribeTsc( |
| 166 | state: RunnerState, |
| 167 | onChange: (state: RunnerState) => void, |
| 168 | ) { |
| 169 | // Run TS in incremental watch mode |
| 170 | watchSrc( |
| 171 | function onStart() { |
| 172 | // Notify the user when compilation starts but don't clear the screen yet |
| 173 | console.log('\nCompiling...'); |
| 174 | }, |
| 175 | isTypecheckSuccess => { |
| 176 | let isCompilerBuildValid = false; |
| 177 | if (isTypecheckSuccess) { |
| 178 | try { |
| 179 | execSync('yarn build', {cwd: PROJECT_ROOT}); |
| 180 | console.log('Built compiler successfully with tsup'); |
| 181 | isCompilerBuildValid = true; |
| 182 | } catch (e) { |
| 183 | console.warn('Failed to build compiler with tsup:', e); |
| 184 | } |
| 185 | } |
| 186 | // Bump the compiler version after a build finishes |
| 187 | // and re-run tests |
| 188 | if (isCompilerBuildValid) { |
| 189 | state.compilerVersion++; |
| 190 | } |
| 191 | state.isCompilerBuildValid = isCompilerBuildValid; |
| 192 | state.mode.action = RunnerAction.Test; |
| 193 | onChange(state); |
| 194 | }, |
| 195 | ); |
| 196 | } |
| 197 | |
| 198 | function subscribeKeyEvents( |
| 199 | state: RunnerState, |
no test coverage detected