Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30684 from woocommerce/add/api-test-script-schedu…
…led-run Run API tests with regular run and add script
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Run package scripts | ||
# | ||
|
||
# Script help | ||
usage() { | ||
echo 'usage: npx wc-api-tests <script>' | ||
echo 'scripts:' | ||
echo ' test <group> - run API tests with the specified group' | ||
echo ' make:collection - build a Postman API Collection' | ||
} | ||
|
||
# Parameter check | ||
if [ $# -lt 1 ]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
# Store original path | ||
OLDPATH=$(pwd) | ||
|
||
# Return value for CI test runs | ||
TESTRESULT=0 | ||
|
||
# Use the script symlink to find and change directory to the root of the package | ||
SCRIPTPATH=$(dirname "$0") | ||
REALPATH=$(readlink "$0") | ||
cd "$SCRIPTPATH/$(dirname "$REALPATH")/.." | ||
|
||
# Run scripts | ||
case $1 in | ||
'test') | ||
jest --group=$2 | ||
TESTRESULT=$? | ||
;; | ||
'make:collection') | ||
node utils/api-collection/build-collection.js $2 | ||
TESTRESULT=$? | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
|
||
# Restore working path | ||
cd "$OLDPATH" | ||
|
||
exit $TESTRESULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters