mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
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:
parent
74205206d5
commit
df06fd0852
1 changed files with 6 additions and 0 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::thread;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use insta::{assert_snapshot, assert_yaml_snapshot, with_settings};
|
use insta::{assert_snapshot, assert_yaml_snapshot, with_settings};
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
@ -43,6 +45,7 @@ fn scripts() {
|
||||||
});
|
});
|
||||||
|
|
||||||
fs::write(session.path().join("src/foo.luau"), "Updated foo!").unwrap();
|
fs::write(session.path().join("src/foo.luau"), "Updated foo!").unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
let socket_packet = session
|
let socket_packet = session
|
||||||
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
||||||
|
|
@ -109,6 +112,7 @@ fn remove_file() {
|
||||||
);
|
);
|
||||||
|
|
||||||
fs::remove_file(session.path().join("src/hello.txt")).unwrap();
|
fs::remove_file(session.path().join("src/hello.txt")).unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
let socket_packet = session
|
let socket_packet = session
|
||||||
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
.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();
|
fs::write(session.path().join("src/init.luau"), b"-- Edited contents").unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
let socket_packet = session
|
let socket_packet = session
|
||||||
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
.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();
|
fs::remove_file(session.path().join("src/target.model.json5")).unwrap();
|
||||||
|
thread::sleep(Duration::from_millis(100));
|
||||||
|
|
||||||
let socket_packet = session
|
let socket_packet = session
|
||||||
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
.get_api_socket_packet(SocketPacketType::Messages, 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue