Fix tests being flaky

This commit is contained in:
Filip Tibell 2023-03-22 14:12:05 +01:00
parent 94c1f42dbe
commit 440d5f7ab1
No known key found for this signature in database
5 changed files with 43 additions and 29 deletions

View file

@ -17,6 +17,9 @@ jobs:
with: with:
components: rustfmt, clippy components: rustfmt, clippy
- name: Install project tools
uses: ok-nick/setup-aftman@v0.3.0
- name: Rustfmt - name: Rustfmt
run: cargo fmt -- --check run: cargo fmt -- --check
@ -27,10 +30,7 @@ jobs:
run: cargo clippy run: cargo clippy
- name: Test - Lune - name: Test - Lune
run: cargo test --package lune run: just test
- name: Test - Lune Roblox
run: cargo test --package lune-roblox
- name: Test - CLI - name: Test - CLI
run: cargo test --package lune-cli run: just test-cli

7
.justfile Normal file
View file

@ -0,0 +1,7 @@
# Run tests for the Lune library
test:
cargo test --package lune -- --test-threads 1
# Run tests for the Lune CLI
test-cli:
cargo test --package lune-cli

View file

@ -1,4 +1,5 @@
[tools] [tools]
just = "readysetplay/just@1.8.0"
luau-lsp = "JohnnyMorganz/luau-lsp@1.15.0" luau-lsp = "JohnnyMorganz/luau-lsp@1.15.0"
selene = "Kampfkarren/selene@0.24.0" selene = "Kampfkarren/selene@0.24.0"
stylua = "JohnnyMorganz/StyLua@0.16.0" stylua = "JohnnyMorganz/StyLua@0.16.0"

View file

@ -228,7 +228,7 @@ impl Instance {
// keep track of all current instance reference structs // keep track of all current instance reference structs
let dom = INTERNAL_DOM let dom = INTERNAL_DOM
.try_read() .try_read()
.expect("Failed to get write access to document"); .expect("Failed to get read access to document");
dom.get_by_ref(self.dom_ref).is_none() dom.get_by_ref(self.dom_ref).is_none()
} }

View file

@ -93,27 +93,33 @@ create_tests! {
#[cfg(feature = "roblox")] #[cfg(feature = "roblox")]
create_tests! { create_tests! {
roblox_axes: "roblox/datatypes/Axes", roblox_datatype_axes: "roblox/datatypes/Axes",
roblox_brick_color: "roblox/datatypes/BrickColor", roblox_datatype_brick_color: "roblox/datatypes/BrickColor",
roblox_cframe: "roblox/datatypes/CFrame", roblox_datatype_cframe: "roblox/datatypes/CFrame",
roblox_color3: "roblox/datatypes/Color3", roblox_datatype_color3: "roblox/datatypes/Color3",
roblox_color_sequence: "roblox/datatypes/ColorSequence", roblox_datatype_color_sequence: "roblox/datatypes/ColorSequence",
roblox_color_sequence_keypoint: "roblox/datatypes/ColorSequenceKeypoint", roblox_datatype_color_sequence_keypoint: "roblox/datatypes/ColorSequenceKeypoint",
roblox_enum: "roblox/datatypes/Enum", roblox_datatype_enum: "roblox/datatypes/Enum",
roblox_faces: "roblox/datatypes/Faces", roblox_datatype_faces: "roblox/datatypes/Faces",
roblox_font: "roblox/datatypes/Font", roblox_datatype_font: "roblox/datatypes/Font",
roblox_number_range: "roblox/datatypes/NumberRange", roblox_datatype_number_range: "roblox/datatypes/NumberRange",
roblox_number_sequence: "roblox/datatypes/NumberSequence", roblox_datatype_number_sequence: "roblox/datatypes/NumberSequence",
roblox_number_sequence_keypoint: "roblox/datatypes/NumberSequenceKeypoint", roblox_datatype_number_sequence_keypoint: "roblox/datatypes/NumberSequenceKeypoint",
roblox_physical_properties: "roblox/datatypes/PhysicalProperties", roblox_datatype_physical_properties: "roblox/datatypes/PhysicalProperties",
roblox_ray: "roblox/datatypes/Ray", roblox_datatype_ray: "roblox/datatypes/Ray",
roblox_rect: "roblox/datatypes/Rect", roblox_datatype_rect: "roblox/datatypes/Rect",
roblox_udim: "roblox/datatypes/UDim", roblox_datatype_udim: "roblox/datatypes/UDim",
roblox_udim2: "roblox/datatypes/UDim2", roblox_datatype_udim2: "roblox/datatypes/UDim2",
roblox_region3: "roblox/datatypes/Region3", roblox_datatype_region3: "roblox/datatypes/Region3",
roblox_region3int16: "roblox/datatypes/Region3int16", roblox_datatype_region3int16: "roblox/datatypes/Region3int16",
roblox_vector2: "roblox/datatypes/Vector2", roblox_datatype_vector2: "roblox/datatypes/Vector2",
roblox_vector2int16: "roblox/datatypes/Vector2int16", roblox_datatype_vector2int16: "roblox/datatypes/Vector2int16",
roblox_vector3: "roblox/datatypes/Vector3", roblox_datatype_vector3: "roblox/datatypes/Vector3",
roblox_vector3int16: "roblox/datatypes/Vector3int16", roblox_datatype_vector3int16: "roblox/datatypes/Vector3int16",
roblox_files_read_model: "roblox/files/readModelFile",
roblox_files_read_place: "roblox/files/readPlaceFile",
roblox_files_write_model: "roblox/files/writeModelFile",
roblox_files_write_place: "roblox/files/writePlaceFile",
roblox_instance_new: "roblox/instance/new",
roblox_instance_properties: "roblox/instance/properties",
} }