Skip to content

Commit

Permalink
Merge pull request #2201 from storybooks/cli-autocleanup
Browse files Browse the repository at this point in the history
CLI test: always remove `run` directory before exiting
  • Loading branch information
Hypnosphi committed Nov 1, 2017
2 parents 40776bf + d853591 commit 640dc32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
},
"scripts": {
"test-latest-cra": "cd test && ./test_latest_cra.sh",
"posttest-latest-cra": "yarn posttest",
"test": "cd test && ./run_tests.sh",
"posttest": "rm -rfd test/run"
"test": "cd test && ./run_tests.sh"
},
"dependencies": {
"@storybook/codemod": "^3.3.0-alpha.2",
Expand Down
12 changes: 10 additions & 2 deletions lib/cli/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
# exit on error
set -e

declare test_root=$PWD

# remove run directory before exit to prevent yarn.lock spoiling
function cleanup {
rm -rfd ${test_root}/run
}
trap cleanup EXIT

update=0
skip=0
fixtures_dir='fixtures'
Expand Down Expand Up @@ -65,9 +73,9 @@ if [ $update -eq 1 ]
fi

# install all the dependencies in a single run
cd ..
cd ../../..
yarn --pure-lockfile
cd test/run
cd ${test_root}/run

for dir in *
do
Expand Down

0 comments on commit 640dc32

Please sign in to comment.