Repository navigation
Add unit tests and fix build args being saved as env vars - #157
Merged
Merged
Conversation
Run test/*.test.js alongside the Dockerfile snapshot tests, and stub bun when it isn't installed so the bun snapshots pass locally.
kylemclaren
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The only tests today are the Dockerfile snapshot tests in
test/test.js, plus the Shopify tests from #154. They check that each fixture generates the expected files, but nothing covers the CLI flags that save topackage.json, the fly.io setup infly.js, or most of the generator's detection logic. Two of the bugs that test reveals (#144, and the build-args one fixed here) had been sitting unnoticed.The bun snapshot tests (
base: bun,base: cache-bun,frameworks: svelte-bun) also fail on any machine without bun installed, sonpm testwas red locally even when CI was green.Changes
npm testnext to the snapshot tests:test/cli.test.jsrunsindex.jsitself. Covers saving and resetting flags, adding and removing packages, envs, build args, instruction files, mount secrets, and--skip/--force.test/gdf.test.jscovers framework and runtime detection, picking the package manager from lockfiles, Node version selection, Next.js/Astro/Prisma/Litestream handling, and--skip/--forceon existing files. The interactive overwrite prompt (Y/n/a/q/d) is not covered yet.test/fly.test.jscovers app name and secrets parsing, swap, sqlite volumes, LiteFS/consul, Remix/Adonis secrets, Prisma release commands, GitHub Actions staging, and Shopify env/config.test/helpers.jsprovides aSandbox: a scratch app dir plus a bin dir of stubflyctl/shopify/bun/etc. PATH is limited to the stubs plus/usr/binand/bin, so tools installed through Homebrew, nvm, etc. can't change results.test/test.jsputs a stubbunon PATH when bun isn't installed. The snapshots already mask the version, and CI still uses real bun.test:capturenow runs onlytest/test.js, so refreshing snapshots doesn't also run the new unit tests.index.jssavedoptions.vars[stage](env vars) underdockerfile.args, so--arg-<stage>values were replaced by that stage's env vars inpackage.jsonand lost on the next run. One-word fix:options.args[stage].package.jsonfiles written by earlier versions are not repaired: stray env vars underdockerfile.argshave to be removed by hand (or with--arg-<stage> NAME:).Known bugs left as
it.skipEach has a
// BUG:comment with the cause. I kept them out of this PR so it stays reviewable:--instructions/--instructions-deploycrash (Does --instructions-deploy not work? #144). Fixed in Fix crash with --instructions and --instructions-deploy #155; unskip once it lands.--swapwith MB/GB suffixes is off by 10x (1GB gives 95MB of swap).--swapwith no suffix (e.g.--swap 0) throws.swap_size_mbset by hand infly.tomlis removed on every run.flyMakeVolumenever creates missing sqlite volumes (it loops over the wrong map).scriptsinpackage.jsonthrows..gitignorecrashes withpath is not definedin.dockerignore.ejs.Testing
npm test: 352 passing, 10 pending, 0 failing, without bun installed.maingives 126 passing and 3 failing on the same machine.saves build argumentstest fails onmainand passes with the fix.eslintclean.🤖 Generated with Claude Code