Add sleep duration in serve tests for stability

- Introduced a 100ms sleep in multiple test functions to ensure stability during file operations and socket packet retrieval.
- This change aims to mitigate timing issues that may arise from rapid file changes and improve the reliability of test outcomes.
This commit is contained in:
Joe 2026-02-04 15:59:19 -06:00
parent 74205206d5
commit df06fd0852

View file

@ -1,4 +1,6 @@
use std::fs;
use std::thread;
use std::time::Duration;
use insta::{assert_snapshot, assert_yaml_snapshot, with_settings};
use tempfile::tempdir;
@ -43,6 +45,7 @@ fn scripts() {
});
fs::write(session.path().join("src/foo.luau"), "Updated foo!").unwrap();
thread::sleep(Duration::from_millis(100));
let socket_packet = session
.get_api_socket_packet(SocketPacketType::Messages, 0)
@ -109,6 +112,7 @@ fn remove_file() {
);
fs::remove_file(session.path().join("src/hello.txt")).unwrap();
thread::sleep(Duration::from_millis(100));
let socket_packet = session
.get_api_socket_packet(SocketPacketType::Messages, 0)
@ -141,6 +145,7 @@ fn edit_init() {
);
fs::write(session.path().join("src/init.luau"), b"-- Edited contents").unwrap();
thread::sleep(Duration::from_millis(100));
let socket_packet = session
.get_api_socket_packet(SocketPacketType::Messages, 0)
@ -484,6 +489,7 @@ fn ref_properties_remove() {
);
fs::remove_file(session.path().join("src/target.model.json5")).unwrap();
thread::sleep(Duration::from_millis(100));
let socket_packet = session
.get_api_socket_packet(SocketPacketType::Messages, 0)