Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report CLI tests to teamcity #4671

Merged
merged 3 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object OpenSourceProjects_Storybook_CliTest : BuildType({
set -e -x

yarn
yarn test --cli
yarn test --cli --teamcity
""".trimIndent()
dockerImage = "node:%docker.node.version%"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object OpenSourceProjects_Storybook_CliTestLatestCra : BuildType({
set -e -x

yarn
yarn test-latest-cra
yarn test-latest-cra -t
""".trimIndent()
dockerImage = "node:%docker.node.version%"
}
Expand Down
29 changes: 27 additions & 2 deletions lib/cli/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ function cleanup {
trap cleanup EXIT

fixtures_dir='fixtures'
teamcity=0

# parse command-line options
# '-f' sets fixtures directory
while getopts ":uosf:" opt; do
# '-t' adds teamcity reporting
while getopts ":tf:" opt; do
case $opt in
f)
fixtures_dir=$OPTARG
;;
t)
teamcity=1
;;
esac
done

Expand Down Expand Up @@ -49,7 +54,27 @@ for dir in *
do
# check that storybook starts without errors
cd $dir

if [ $teamcity -eq 1 ]
then
echo "##teamcity[testStarted name='$dir' captureStandardOutput='true']"
fi

echo "Running smoke test in $dir"
yarn storybook --smoke-test
failed=0
yarn storybook --smoke-test || failed=1

if [ $teamcity -eq 1 ]
then
if [ $failed -eq 1 ]
then
echo "##teamcity[testFailed name='$dir']"
fi
echo "##teamcity[testFinished name='$dir']"
elif [ $failed -eq 1 ]
then
exit 1
fi

cd ..
done
2 changes: 1 addition & 1 deletion lib/cli/test/test_latest_cra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ cd cra-fixtures
npx create-react-app react-scripts-latest-fixture

cd ..
./run_tests.sh -f cra-fixtures
./run_tests.sh -f cra-fixtures $@
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"repo-dirty-check": "node ./scripts/repo-dirty-check",
"start": "yarn --cwd examples/official-storybook storybook",
"test": "node ./scripts/test.js",
"test-latest-cra": "npm --prefix lib/cli run test-latest-cra"
"test-latest-cra": "yarn --cwd lib/cli run test-latest-cra"
},
"devDependencies": {
"@angular/common": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const tasks = {
name: `Use TeamCity reporter`,
defaultValue: false,
option: '--teamcity',
extraParam: '--testResultsProcessor=jest-teamcity-reporter',
extraParam: '-t --testResultsProcessor=jest-teamcity-reporter',
}),
};

Expand Down