Skip to content

Commit e5b723c

Browse files
committed
Add test for only formatting the current project.
1 parent c740f4e commit e5b723c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

rewatch/tests/format.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,18 @@ else
4242
echo $error_output
4343
exit 1
4444
fi
45+
46+
bold "Test: It should format only the current project"
47+
48+
error_output=$(cd packages/file-casing && "../../$REWATCH_EXECUTABLE" format)
49+
git_diff_file_count=$(git diff --name-only ./ | wc -l | xargs)
50+
if [ $? -eq 0 ] && [ $git_diff_file_count -eq 2 ];
51+
then
52+
success "file-casing formatted"
53+
git restore .
54+
else
55+
error "Error formatting current project file-casing"
56+
echo "Expected 2 files to be changed, got $git_diff_file_count"
57+
echo $error_output
58+
exit 1
59+
fi

0 commit comments

Comments
 (0)