Adds a check if a wasm binary already exists for each suite.
Adds a check (is_source_modified function) if any of the .test.ts files in each suite has been changed since the last time the wasm binary was compiled. The function first checks if the whole suite folder has been modified, e.g. files have been removed/added, if not - loops through each suite's files and compares modified time with the binary modified time. If any test file has been changed since the last time the suite has been compiled, the loop breaks, the function returns true and the suite is recompiled. - UPDATED
Adds #skip_compile method to impl Compiler, that returns a CompileOutput struct with a mocked ExitStatus using the ExitStatusExt* trait.
Extracts let (in_files, out_file) = Compiler::get_paths_for(name.clone(), entry); from #compile to main.rs, because in_files and out_file are used to check if any files were changed.
Had to change the arguments which #compile accepts. It is usually not a good thing and goes against the design principles, but on the other hand imo #compile should not be bothered with the logic if it should compile the suite or not and this logic should be outside the method.
Prints to the logs which test are being compiled and which have been skipped.
* ExitStatusExt has a unix and windows versions. I have included it like this, but I don't know if this is the correct way:
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt;
#[cfg(windows)]
use std::os::winows::process::ExitStatusExt;
The alternative is using Command::new() with some dummy command like echo and using the status from the output (hacky)
Issues: closes https://github.com/LimeChain/matchstick/issues/223
What it does:
wasm
binary already exists for each suite.is_source_modified
function) if any of the.test.ts
files in each suite has been changed since the last time thewasm
binary was compiled. The function first checks if the whole suite folder has been modified, e.g. files have been removed/added, if not - loops through each suite's files and comparesmodified
time with the binarymodified
time. If any test file has been changed since the last time the suite has been compiled, the loop breaks, the function returnstrue
and the suite is recompiled. - UPDATED#skip_compile
method toimpl Compiler
, that returns aCompileOutput
struct with a mockedExitStatus
using theExitStatusExt*
trait.let (in_files, out_file) = Compiler::get_paths_for(name.clone(), entry);
from#compile
tomain.rs
, becausein_files
andout_file
are used to check if any files were changed.#compile
accepts. It is usually not a good thing and goes against the design principles, but on the other hand imo#compile
should not be bothered with the logic if it should compile the suite or not and this logic should be outside the method.* ExitStatusExt
has aunix
andwindows
versions. I have included it like this, but I don't know if this is the correct way:The alternative is using
Command::new()
with some dummy command likeecho
and using the status from the output (hacky)Screenshots: