Skip to content

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

Closed
keithharvey wants to merge 1 commit into
beyond-all-reason:fmtfrom
keithharvey:mig-integration-tests
Closed

[Tests] Restructure integration tests to table-return shape#7437
keithharvey wants to merge 1 commit into
beyond-all-reason:fmtfrom
keithharvey:mig-integration-tests

Conversation

@keithharvey

@keithharvey keithharvey commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Warning

Superseded — this PR was an earlier mint of the stack. The type-error cleanup
now lands via the current stack tip fmt-llm #8398.
This slice's current counterpart is #8404.
Kept closed for review history; nothing here merges.

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-22 19:44:41 UTC.

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

Branch Command Diff vs parent Units
fmt stylua 1425 files, +196955 −195449 ✅ pass
mig-bracket bar-lua-codemod bracket-to-dot 351 files, +7779 −7779 ✅ pass
mig-rename-aliases bar-lua-codemod rename-aliases 177 files, +376 −376 ✅ pass
mig-detach-bar-modules bar-lua-codemod detach-bar-modules 181 files, +1702 −1573 ✅ pass
👉 mig-integration-tests — you are here <hand curated> 20 files, +134 −81 ✅ pass
mig-busted-types <hand curated> 12 files, +1501 −0 ✅ pass

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

Branch Diff vs master Diff vs parent Units
mig 1449 files, +201211 −198022 528 files, +11446 −9763 ✅ pass
fmt-llm-source 1454 files, +201680 −198185 61 files, +523 −217 ✅ pass
fmt-llm 1456 files, +201733 −198206 32 files, +70 −38 ✅ pass

@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

14 tests   6 ✅  3s ⏱️
 1 suites  8 💤
 1 files    0 ❌

Results for commit 2198b31.

♻️ This comment has been updated with latest results.

Comment thread luaui/Widgets/dbg_test_runner.lua
@keithharvey
keithharvey force-pushed the mig-integration-tests branch 3 times, most recently from 41cf71d to 03f81d6 Compare April 16, 2026 22:06
@keithharvey
keithharvey force-pushed the mig-integration-tests branch 4 times, most recently from 0149d82 to 41567d3 Compare April 22, 2026 18:12
@keithharvey
keithharvey force-pushed the mig-integration-tests branch 2 times, most recently from 4d27c69 to c0d833f Compare April 24, 2026 16:39
@keithharvey
keithharvey changed the base branch from master to fmt April 24, 2026 16:40
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from c0d833f to c13a6ac Compare April 24, 2026 17:31
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from c13a6ac to 01cfccf Compare April 24, 2026 19:35
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 01cfccf to 79c8baf Compare April 29, 2026 00:17
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 7447704 to 3c90fd6 Compare June 11, 2026 10:25
Comment thread luaui/Tests/cmd_blueprint/test_cmd_blueprint_single.lua
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 3c90fd6 to 3acf0d1 Compare July 7, 2026 07:52
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 3acf0d1 to b96847d Compare July 7, 2026 21:26
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from b96847d to 3b9eafc Compare July 7, 2026 21:45
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 3b9eafc to c27cdc3 Compare July 8, 2026 05:18
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from c27cdc3 to d886764 Compare July 8, 2026 09:06
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from d886764 to 7297a0d Compare July 8, 2026 09:22
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 7297a0d to 1929c12 Compare July 8, 2026 17:46
@keithharvey
keithharvey force-pushed the mig-integration-tests branch from 1929c12 to c8fa8d7 Compare July 8, 2026 18:56
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
@keithharvey

Copy link
Copy Markdown
Collaborator Author

Superseded by #8404 — recreated with its head on beyond-all-reason instead of the fork; the whole migration stack now lives same-repo. Branch content is identical; review history stays readable here.

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.

3 participants