diff --git a/tests/lib/rewatch.lock b/tests/lib/rewatch.lock new file mode 100644 index 0000000..da27e6c --- /dev/null +++ b/tests/lib/rewatch.lock @@ -0,0 +1 @@ +57150 \ No newline at end of file diff --git a/tests/suffix.sh b/tests/suffix.sh new file mode 100755 index 0000000..a7fe978 --- /dev/null +++ b/tests/suffix.sh @@ -0,0 +1,56 @@ +source "./utils.sh" +cd ../testrepo + +bold "Test: It should support custom suffixes" + +# Clean Repo +sleep 1 +if rewatch clean &> /dev/null; +then + success "Repo Cleaned" +else + error "Error Cleaning Repo" + exit 1 +fi + +# Replace suffix +replace "s/.mjs/.res.js/g" bsconfig.json + +if rewatch build &> /dev/null; +then + success "Repo Built" +else + error "Error building repo" + exit 1 +fi + +# Count files with new extension +file_count=$(find . -name *.res.js | wc -l) + +if [ "$file_count" -eq 9 ]; +then + success "Found files with correct suffix" +else + error "Suffix not correctly used" + exit 1 +fi + +if rewatch clean &> /dev/null; +then + success "Repo Cleaned" +else + error "Error Cleaning Repo" + exit 1 +fi + +# Restore Suffix +replace "s/.res.js/.mjs/g" bsconfig.json + +# Restore original build +if rewatch build &> /dev/null; +then + success "Repo Built" +else + error "Error building repo" + exit 1 +fi diff --git a/tests/suite-ci.sh b/tests/suite-ci.sh index d0f883f..bcec567 100755 --- a/tests/suite-ci.sh +++ b/tests/suite-ci.sh @@ -22,4 +22,4 @@ else exit 1 fi -./compile.sh && ./watch.sh && ./lock.sh +./compile.sh && ./watch.sh && ./lock.sh && ./suffix.sh