-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add unit testing library as dependency (#26)
- Loading branch information
Showing
5 changed files
with
1,887 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
GIT_ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
# Installs yarn if it is not already installed. | ||
function looker::install_yarn() { | ||
if command -v yarn &> /dev/null; then | ||
npm install -g yarn | ||
fi | ||
} | ||
|
||
# Configures the project if the user has not already done so. | ||
function looker::configure() { | ||
looker::install_yarn | ||
pushd "$GIT_ROOT_DIR" &> /dev/null | ||
if [[ ! -d "$GIT_ROOT_DIR/node_modules" ]]; then | ||
yarn | ||
fi | ||
popd &> /dev/null | ||
} | ||
|
||
# Runs all the unit tests. | ||
function looker::test() { | ||
pushd "$GIT_ROOT_DIR" &> /dev/null | ||
env NODE_OPTIONS="--openssl-legacy-provider" yarn test | ||
popd &> /dev/null | ||
} | ||
|
||
# Entry-point. | ||
function looker::main() { | ||
looker::configure | ||
looker::test | ||
} | ||
|
||
looker::main | ||
|
||
exit 0 |
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,9 @@ | ||
function example() { | ||
return 'hi'; | ||
} | ||
|
||
describe('example', () => { | ||
test('should say hi', () => { | ||
expect(example()).toBe('hi'); | ||
}); | ||
}); |
Oops, something went wrong.