Skip to content

Commit e77905c

Browse files
authored
Ensures that CI and local development workflows behave the same (#941)
I discovered an issue in CI where `lute test` would fail to require the `difftext` test file. Instead of causing CI to fail, this would silently skip that test suite. Moreover, there is a divergence in how tests run in the presence of the .ci.luaurc file vs the .luaurc file. Today, we don't define a batteries alias in the .ci.luaurc because we have tests that rely on asserting that user code cannot require batteries. This also causes a divergence in how C++ and luau tests are run - luau tests pass with the regular .luaurc because some tests rely on the .luaurc to figure out where batteries are located. - luau tests fail with the .luaurc.ci because that doesn't have a batteries alias. - C++ tests pass with the .luaurc.i because that doesn't have a batteries alias - C++ tests fail with the regular .luaurc because the batteries alias is defined in the root of the repo The cause of the luau tests failing is that `loadModule` loads a test case as user code, which has no access to @Batteries. It uses a .luaurc to find the local `@batteries`. The `difftext` battery itself requires the `deque` module in batteries, which causes us to look for a @Batteries alias somewhere (which doesn't exist in CI). To fix this, I've added a .luaurc with the `@batteries` alias defined to the batteries/ directories. I've also: - gotten rid of the step that changes the luaurc we run with in CI - added .luaurc's to files that rely on local access to batteries, either for execution (examples/ tools/) or for editor support (std/libs). - added a ps.exit(1), so that test running failures will cause CI to fail.
1 parent e711f1f commit e77905c

File tree

7 files changed

+21
-8
lines changed

7 files changed

+21
-8
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ jobs:
6565
options: ${{ matrix.options }}
6666
token: ${{ secrets.GITHUB_TOKEN }}
6767
use-bootstrap: ${{ matrix.use-bootstrap || 'false' }}
68-
69-
- name: Use CI .luaurc file
70-
if: ${{ steps.should_run.outputs.proceed == 'true' }}
71-
run: rm .luaurc && mv .luaurc.ci .luaurc
72-
7368
- name: Run Luau Tests (POSIX)
7469
if: ${{ steps.should_run.outputs.proceed == 'true' }}
7570
run: ${{ steps.build_lute.outputs.exe_path }} test

.luaurc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"languageMode": "strict",
33
"aliases": {
4-
"batteries": "./batteries",
54
"std": "./lute/std/libs",
65
"lute": "./definitions",
76
"commands": "./lute/cli/commands"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"languageMode": "strict",
33
"aliases": {
4-
"commands": "./lute/cli/commands"
4+
"batteries": "./"
55
}
6-
}
6+
}

examples/.luaurc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"languageMode": "strict",
3+
"aliases": {
4+
"batteries": "../batteries"
5+
}
6+
}

lute/cli/commands/test/init.luau

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ local function loadtests(testfiles: { path.Path })
1818

1919
if not success then
2020
print(`Error loading {path.format(p)}: {err}`)
21+
ps.exit(1)
2122
end
2223
end
2324
end

lute/std/libs/.luaurc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"languageMode": "strict",
3+
"aliases": {
4+
"batteries": "../../../batteries"
5+
}
6+
}

tools/.luaurc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"languageMode": "strict",
3+
"aliases": {
4+
"batteries": "../batteries"
5+
}
6+
}

0 commit comments

Comments
 (0)