core-agent-ide/codex-cli/tests
Michael Bolin 05bb5d7d46
fix: always load version from package.json at runtime (#909)
Note the high-level motivation behind this change is to avoid the need
to make temporary changes in the source tree in order to cut a release
build since that runs the risk of leaving things in an inconsistent
state in the event of a failure. The existing code:

```
import pkg from "../../package.json" assert { type: "json" };
```

did not work as intended because, as written, ESBuild would bake the
contents of the local `package.json` into the release build at build
time whereas we want it to read the contents at runtime so we can use
the `package.json` in the tree to build the code and later inject a
modified version into the release package with a timestamped build
version.

Changes:

* move `CLI_VERSION` out of `src/utils/session.ts` and into
`src/version.ts` so `../package.json` is a correct relative path both
from `src/version.ts` in the source tree and also in the final
`dist/cli.js` build output
* change `assert` to `with` in `import pkg` as apparently `with` became
standard in Node 22
* mark `"../package.json"` as external in `build.mjs` so the version is
not baked into the `.js` at build time

After using `pnpm stage-release` to build a release version, if I use
Node 22.0 to run Codex, I see the following printed to stderr at
startup:

```
(node:71308) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
```

Note it is a warning and does not prevent Codex from running.

In Node 22.12, the warning goes away, but the warning still appears in
Node 22.11. For Node 22, 22.15.0 is the current LTS version, so LTS
users will not see this.

Also, something about moving the definition of `CLI_VERSION` caused a
problem with the mocks in `check-updates.test.ts`. I asked Codex to fix
it, and it came up with the change to the test configs. I don't know
enough about vitest to understand what it did, but the tests seem
healthy again, so I'm going with it.
2025-05-12 21:27:15 -07:00
..
__fixtures__ Initial commit 2025-04-16 12:56:08 -04:00
__snapshots__ refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) 2025-04-21 00:00:20 -07:00
agent-cancel-early.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-cancel-prev-response.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-cancel-race.test.ts perf: optimize token streaming with balanced approach (#635) 2025-04-25 10:49:38 -07:00
agent-cancel.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-dedupe-items.test.ts fix: duplicate messages in quiet mode (#680) 2025-04-26 09:14:50 -07:00
agent-function-call-id.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-generic-network-error.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-interrupt-continue.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-invalid-request-error.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-max-tokens-error.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-network-errors.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-project-doc.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-rate-limit-error.test.ts feat: lower default retry wait time and increase number of tries (#720) 2025-04-28 21:11:30 -07:00
agent-server-retry.test.ts feat: lower default retry wait time and increase number of tries (#720) 2025-04-28 21:11:30 -07:00
agent-terminate.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
agent-thinking-time.test.ts chore: upgrade prettier to v3 (#644) 2025-04-25 07:21:50 -07:00
api-key.test.ts Initial commit 2025-04-16 12:56:08 -04:00
apply-patch.test.ts feat: more loosely match context for apply_patch (#610) 2025-04-24 09:05:19 -07:00
approvals.test.ts when a shell tool call invokes apply_patch, resolve relative paths against workdir, if specified (#556) 2025-04-22 14:07:47 -07:00
cancel-exec.test.ts fix: increase output limits for truncating collector (#575) 2025-05-05 10:26:55 -07:00
check-updates.test.ts fix: always load version from package.json at runtime (#909) 2025-05-12 21:27:15 -07:00
clear-command.test.tsx fix: remove outdated copy of text input and external editor feature (#670) 2025-04-25 16:11:16 -07:00
config.test.tsx fix: increase output limits for truncating collector (#575) 2025-05-05 10:26:55 -07:00
config_reasoning.test.ts feat: add --reasoning CLI flag (#314) 2025-04-29 07:30:49 -07:00
create-truncating-collector.test.ts include fractional portion of chunk that exceeds stdout/stderr limit (#497) 2025-04-21 19:06:03 -07:00
disableResponseStorage.agentLoop.test.ts Fixes issue #726 by adding config to configToSave object (#728) 2025-04-29 13:10:16 -04:00
disableResponseStorage.test.ts Fixes issue #726 by adding config to configToSave object (#728) 2025-04-29 13:10:16 -04:00
dummy.test.ts Initial commit 2025-04-16 12:56:08 -04:00
exec-apply-patch.test.ts feat: create parent directories when creating new files. (#552) 2025-04-22 19:45:17 -04:00
file-system-suggestions.test.ts feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
file-tag-utils.test.ts feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
fixed-requires-shell.test.ts fix: command pipe execution by improving shell detection (#437) 2025-04-20 21:11:19 -07:00
format-command.test.ts Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
history-overlay.test.tsx perf: optimize token streaming with balanced approach (#635) 2025-04-25 10:49:38 -07:00
input-utils.test.ts re-enable Prettier check for codex-cli in CI (#417) 2025-04-19 11:22:45 -07:00
invalid-command-handling.test.ts fix: increase output limits for truncating collector (#575) 2025-05-05 10:26:55 -07:00
markdown.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
model-info.test.ts feat: add openai model info configuration (#551) 2025-04-22 17:31:25 -04:00
model-utils-network-error.test.ts chore: consolidate model utils and drive-by cleanups (#476) 2025-04-21 12:33:57 -04:00
model-utils.test.ts feat: add openai model info configuration (#551) 2025-04-22 17:31:25 -04:00
multiline-ctrl-enter-submit.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
multiline-dynamic-width.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
multiline-enter-submit-cr.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
multiline-history-behavior.test.tsx fix: remove outdated copy of text input and external editor feature (#670) 2025-04-25 16:11:16 -07:00
multiline-input-test.ts Initial commit 2025-04-16 12:56:08 -04:00
multiline-newline.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
multiline-shift-enter-crlf.test.tsx fix: remove outdated copy of text input and external editor feature (#670) 2025-04-25 16:11:16 -07:00
multiline-shift-enter-mod1.test.tsx Fix handling of Shift+Enter in e.g. Ghostty (#338) 2025-04-18 09:19:06 -07:00
multiline-shift-enter.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
package-manager-detector.test.ts refactor(updates): fetch version from registry instead of npm CLI to support multiple managers (#446) 2025-04-21 00:00:20 -07:00
parse-apply-patch.test.ts Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
pipe-command.test.ts fix: command pipe execution by improving shell detection (#437) 2025-04-20 21:11:19 -07:00
project-doc.test.ts Initial commit 2025-04-16 12:56:08 -04:00
raw-exec-process-group.test.ts fix: increase output limits for truncating collector (#575) 2025-05-05 10:26:55 -07:00
requires-shell.test.ts fix: command pipe execution by improving shell detection (#437) 2025-04-20 21:11:19 -07:00
responses-chat-completions.test.ts bug: non-openai mode - fix for gemini content: null, fix 429 to throw before stream (#563) 2025-04-22 20:37:48 -04:00
slash-commands.test.ts feat: /diff command to view git diff (#426) 2025-04-19 16:23:27 -07:00
terminal-chat-completions.test.tsx feat: tab completions for file paths (#279) 2025-04-20 22:34:27 -07:00
terminal-chat-input-compact.test.tsx feat: /diff command to view git diff (#426) 2025-04-19 16:23:27 -07:00
terminal-chat-input-file-tag-suggestions.test.tsx feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
terminal-chat-input-multiline.test.tsx fix: only allow going up in history when not already in history if input is empty (#654) 2025-04-25 09:39:24 -07:00
terminal-chat-model-selection.test.tsx feat: display error on selection of invalid model (#594) 2025-04-24 16:56:00 -07:00
terminal-chat-response-item.test.tsx Initial commit 2025-04-16 12:56:08 -04:00
text-buffer-copy-paste.test.ts Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
text-buffer-crlf.test.ts Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
text-buffer-gaps.test.ts Back out @lib indirection in tsconfig.json (#111) 2025-04-16 14:16:53 -07:00
text-buffer-word.test.ts fix: input keyboard shortcut opt+delete (#685) 2025-04-30 17:17:13 -07:00
text-buffer.test.ts feat: @mention files in codex (#701) 2025-04-30 16:19:55 -07:00
token-streaming-performance.test.ts perf: optimize token streaming with balanced approach (#635) 2025-04-25 10:49:38 -07:00
typeahead-scroll.test.tsx chore: consolidate model utils and drive-by cleanups (#476) 2025-04-21 12:33:57 -04:00
ui-test-helpers.tsx Initial commit 2025-04-16 12:56:08 -04:00
user-config-env.test.ts feat: user config api key (#569) 2025-04-26 10:13:30 -07:00