Skip to content

[Tests] Restructure integration tests to table-return shape - #8404

Open
keithharvey wants to merge 1 commit into
fmtfrom
mig-integration-tests
Open

[Tests] Restructure integration tests to table-return shape#8404
keithharvey wants to merge 1 commit into
fmtfrom
mig-integration-tests

Conversation

@keithharvey

@keithharvey keithharvey commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Warning

Don't merge this PR by itself — it's one slice of a stacked review.
Merging an intermediate PR breaks the stack. The whole cleanup lands by
merging only the tip, fmt-llm, which pulls in every branch below it.

Part of BAR type-error cleanup. Rebuilds idempotently from master via just bar::migrate::stylua-cleanup-generate.

What it does: Hand-curated (not a codemod): restructures the tests under luaui/Tests/ and luaui/TestsExamples/ (20 files) from bare-global hook declarations to a return { ... } shape, and patches dbg_test_runner.lua to read hooks from the returned table.

# integration-tests - restructure luaui/Tests and luaui/TestsExamples files
# from bare-global hook declarations to a return-table shape; patch the
# dbg_test_runner widget to read hooks from the returned table. Carried-
# commit leaf — no codemod; curated branch holds the hand-authored commit.

Isolated so the convention change can be discussed/reverted independently.

Branch Topology

All branches in the BAR type-error cleanup stack — see Bulk Migrations for the migration log and how to run just bar::migrate::stylua-cleanup. Regenerated deterministically by just bar::migrate::stylua-cleanup-generate. Generated 2026-07-30 01:10:21 UTC.

Leaves — each isolates one transform's diff vs fmt:

Branch Command Diff vs parent Units
fmt stylua 1422 files, +197270 −195727 ✅ pass
mig-bracket bar-lua-codemod bracket-to-dot 352 files, +7788 −7788 ✅ pass
mig-rename-aliases bar-lua-codemod rename-aliases 177 files, +374 −374 ✅ pass
mig-detach-bar-modules bar-lua-codemod detach-bar-modules 182 files, +1762 −1599 ✅ pass
👉 mig-integration-tests — you are here <hand curated> 22 files, +137 −83 ✅ pass
mig-busted-types <hand curated> 13 files, +1502 −2 ✅ pass

Rollups — composite branches stacking the leaves and (for fmt-llm) the env + LLM layers:

Branch Diff vs master Diff vs parent Units
mig 1446 files, +201566 −198304 528 files, +11515 −9796 ✅ pass
fmt-llm-source 1451 files, +201968 −198448 58 files, +433 −175 ✅ pass
fmt-llm 1452 files, +202023 −198469 31 files, +72 −38 ✅ pass

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

15 tests   7 ✅  4s ⏱️
 1 suites  8 💤
 1 files    0 ❌

Results for commit e3801d3.

♻️ This comment has been updated with latest results.

distortionType = "point",
distortionConfig = { posx = 0, posy = 8, posz = 0, radius = 20, onlyModelMap = 0, riseRate = 0.5, windAffected = -0.5,
noiseStrength = 0.4, noiseScaleSpace = 2.2, distanceFalloff = 1.2, lifeTime = 0, effectType = 0 },
distortionConfig = { posx = 0, posy = 8, posz = 0, radius = 20, onlyModelMap = 0, riseRate = 0.5, windAffected = -0.5, noiseStrength = 0.4, noiseScaleSpace = 2.2, distanceFalloff = 1.2, lifeTime = 0, effectType = 0 },

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table formatting in the table-return pr, not a big deal though

Restructures the 20 files under luaui/Tests/, luaui/TestsExamples/,
plus the headless-only common/testing/infologtest.lua, from bare-
global hook declarations to a return-table shape. Updates the
dbg_test_runner widget to read test hooks from the returned table.

Motivation: the pre-existing shape required the test files to run
under setfenv(chunk, testEnvironment) and define `function test()`,
`function setup()`, etc. as bare module-level globals that setfenv
redirected into the environment. That works at runtime but emmylua
can't model the sandboxing — it sees 20+ files declaring project-
wide globals like `test`, `setup`, `skip`, `cleanup`. To keep
emmylua happy, .emmyrc.json had to blacklist both test directories
under workspace.ignoreDir — a kludge on clearly-ours code. Lives on
its own leaf so the convention change can be discussed in isolation.

Minimal shape change per file — just prepend `local` to each top-
level `function` declaration, and append a final `return { ... }`
block listing whichever lifecycle hooks (skip/setup/test/cleanup)
that file actually defines. Original indentation and formatting
preserved (no stylua reformatting noise — the fmt transform runs
after this one in the mig pipeline).

Runner patch — luaui/Widgets/dbg_test_runner.lua, loadTestFromFile:
  - capture the return value of pcall(chunk)
  - require it to be a table
  - merge its keys into testEnvironment so runTestInternal still
    reads bare `skip`/`setup`/`test`/`cleanup` under setfenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants