Repository navigation
fix: run test chains that never executed and await runUpdate in udate - #731
arjankowski wants to merge 2 commits into
Conversation
f2ab91c to
d9e7cfc
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Coverage Report for CI Build 39964600876Coverage increased (+2.1%) to 87.047%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
| class GithubUpdatecommand extends UpdateCommand { | ||
| async run() { | ||
| const { printTable } = await import('@oclif/table'); | ||
| const { flags } = await this.parse(UpdateCommand); |
There was a problem hiding this comment.
this.parse(UpdateCommand) still uses the parent arg schema from @oclif/plugin-update, which accepts an optional channel. box update stable therefore parses, then runUpdate is called without that channel. GithubUpdatecommand.args = [] only changes the help text. Parse GithubUpdatecommand so a positional channel is rejected as an unexpected argument.
| '--default-box-app', | ||
| '--code', | ||
| '--port', | ||
| '4000', |
There was a problem hiding this comment.
--code still reaches app.listen. This test binds port 4000, which is often already taken locally, and then fails before it can see Please open. The other callback tests in this file use high ports. Walk SUPPORTED_DEFAULT_APP_PORTS and bind the first free port.
| "@oclif/plugin-update": "3.2.4", | ||
| "@oclif/plugin-version": "^2.2.36", | ||
| "@oclif/table": "^0.5.8", | ||
| "@oclif/table": "0.5.4", |
There was a problem hiding this comment.
@oclif/table is pinned to 0.5.4 with no note in the repo. A later bump to ^0.5.x pulls string-width@8, which throws SyntaxError: Invalid regular expression flags on Node 18 when box update --available loads the table. Maybe we should document this? Here or where the import is defined src/commands/update.js:13.
42 `@oclif/test` chains were nested inside mocha `it` blocks (via `await` or `return`) or had no `.it()`, so they were never scheduled and passed regardless of the code. Move them directly under `describe`, configure stubs in `.do()`, and fix assertions that surfaced once they ran: - read `stderr` instead of `stdout` for messages printed with `this.info` and errors handled by `BoxCommand.catch` - use a port supported by the Official Box CLI app in the login fallback test - accept unset `autoUpdate`/`force` flags as falsy in update tests - drop update channel tests; channel support was removed from the command The re-enabled update tests exposed two bugs in the `update` command: - `runUpdate` was not awaited, so a failed update surfaced as an unhandled promise rejection instead of going through oclif's error handling - `box update` crashed on Node 18 with `SyntaxError: Invalid regular expression flags`: `@oclif/table` >= 0.5.5 depends on `string-width@8`, which requires Node 20. Pin `@oclif/table` to 0.5.4 and import it only for `--available`.
…n test - parse `GithubUpdatecommand` instead of the plugin's `UpdateCommand`, so `box update stable` fails with "Unexpected argument" instead of silently ignoring the channel - bind the first free port from `SUPPORTED_DEFAULT_APP_PORTS` in the `--code` login test instead of hardcoding 4000 - document why `@oclif/table` is pinned to 0.5.4
aaec1b7 to
f2c1a23
Compare
42
@oclif/testchains were nested inside mochaitblocks (viaawaitorreturn) or had no.it(), so they were never scheduled and passed regardless of the code. Move them directly underdescribe, configure stubs in.do(), and fix assertions that surfaced once they ran:stderrinstead ofstdoutfor messages printed withthis.infoand errors handled byBoxCommand.catchautoUpdate/forceflags as falsy in update testsThe re-enabled update tests exposed two bugs in the
updatecommand:runUpdatewas not awaited, so a failed update surfaced as an unhandled promise rejection instead of going through oclif's error handlingbox updatecrashed on Node 18 withSyntaxError: Invalid regular expression flags:@oclif/table>= 0.5.5 depends onstring-width@8, which requires Node 20. Pin@oclif/tableto 0.5.4 and import it only for--available.