-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.sh
executable file
·52 lines (38 loc) · 1.1 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
# Clean up any leftover test directory from previous failed runs.
rm -rf test
# Create the test directory and change there.
mkdir test
cd test || exit 1
# Initiate a git repository.
git init
echo "node_modules" >> .gitignore
# Initiate a new node package.
yarn init -y
# Install the scaffold package.
yarn add ../
# Run the initial scaffold to install dotfiles and scripts.
yarn amazee-scaffold
# Commit the initial package
git add package.json yarn.lock .gitignore tsconfig.json
git commit -m "initial commit"
if [[ -n "$(git status --porcelain)" ]]; then
>&2 echo "Git repository not clean."
exit 1
fi
# Run the (empty) test suite. This is a proof that the tools are there.
yarn test
# Clean the git repository to simulate a fresh checkout.
git clean -xdf
if [ -f jest.config.js ]; then
>&2 echo "Git repository not properly cleaned up."
exit 1
fi
# Run yarn install which should re-scaffold files.
yarn
if [[ ! -f "jest.config.js" ]]; then
>&2 echo "jest.config.js was not scaffolded"
exit 1
fi
# Run the (empty) test suite. This is a proof that the tools are there.
yarn test