-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update-node-on-redesign' into main-ar-redesign
- Loading branch information
Showing
14 changed files
with
2,263 additions
and
1,763 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FROM node:16.17.0 | ||
WORKDIR /app | ||
RUN apt-get update && apt-get install lcov -y |
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,27 @@ | ||
#!/bin/bash | ||
|
||
main(){ | ||
# start collecting our coverage files | ||
coverage_files=("coverage/src/root/lcov.info") | ||
|
||
# then list through the folders and run the tests | ||
targets=("lib" "middleware" "models" "policies" "routes" "scopes" "services" "tools" "widgets") | ||
|
||
for target in "${targets[@]}"; do | ||
coverage_files+=("coverage/src/$target/lcov.info") | ||
done | ||
|
||
# concatenate all the coverage files into one | ||
for f in "${coverage_files[@]}"; do | ||
cat "$f" >> lcov.info | ||
done | ||
|
||
# generate the html report | ||
if lcov -v; then | ||
genhtml lcov.info --output-directory coverage | ||
else | ||
echo "lcov not found. Please install lcov to generate coverage report" | ||
fi | ||
} | ||
|
||
main |
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,63 @@ | ||
#!/bin/bash | ||
|
||
main(){ | ||
# first get the tests in the root directory | ||
node_modules/.bin/cross-env \ | ||
JEST_JUNIT_OUTPUT_DIR=reports \ | ||
JEST_JUNIT_OUTPUT_NAME=root.xml \ | ||
POSTGRES_USERNAME=postgres \ | ||
POSTGRES_DB=ttasmarthub \ | ||
CURRENT_USER_ID=5 \ | ||
CI=true \ | ||
node \ | ||
--expose-gc \ | ||
./node_modules/.bin/jest \ | ||
src/*.js \ | ||
--coverage \ | ||
--colors \ | ||
--reporters=jest-junit \ | ||
--reporters=default \ | ||
--runInBand \ | ||
--silent \ | ||
--colors \ | ||
--logHeapUsage \ | ||
--coverageDirectory="$(pwd)"/coverage/src/root \ | ||
--collectCoverageFrom=src/*.js \ | ||
--forceExit | ||
|
||
# then list through the folders and run the tests | ||
targets=("lib" "middleware" "models" "policies" "routes" "scopes" "services" "tools" "widgets") | ||
|
||
for target in "${targets[@]}"; do | ||
# jest command to | ||
# - run tests in the target folder | ||
# - collect coverage from the target folder | ||
# - output coverage relative to the target folder | ||
# - some other useful flags | ||
|
||
node_modules/.bin/cross-env \ | ||
JEST_JUNIT_OUTPUT_DIR=reports \ | ||
JEST_JUNIT_OUTPUT_NAME="$target".xml \ | ||
POSTGRES_USERNAME=postgres \ | ||
POSTGRES_DB=ttasmarthub \ | ||
CURRENT_USER_ID=5 \ | ||
CI=true \ | ||
node \ | ||
--expose-gc \ | ||
./node_modules/.bin/jest \ | ||
src/"$target" \ | ||
--coverage \ | ||
--colors \ | ||
--reporters=jest-junit \ | ||
--reporters=default \ | ||
--runInBand \ | ||
--silent \ | ||
--colors \ | ||
--logHeapUsage \ | ||
--coverageDirectory="$(pwd)"/coverage/src/"$target" \ | ||
--collectCoverageFrom=src/"$target"/**/*.js \ | ||
--forceExit | ||
done | ||
} | ||
|
||
main |
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
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
Oops, something went wrong.