Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
.DS_Store
docs/_book
test/
tests/*/
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
pre:
- sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list'
- sudo apt-get update
- sudo apt-get install google-chrome-stable
- sudo apt-get install -y google-chrome-stable expect

test:
override:
Expand Down
19 changes: 13 additions & 6 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/env bash

set -e

yes "" | ./node_modules/.bin/vue init . test
cd tests

for f in *.sh; do
filename=$(basename "$f")
testname="${filename%.*}"

source "$f" "$testname"
done

cd ..


cd test
npm install
npm run lint
npm test
npm run build
31 changes: 31 additions & 0 deletions tests/airbnb.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
set testname [lindex $argv 0];
spawn ../node_modules/.bin/vue init .. $testname

expect "Project name"
send "\n"
expect "Project description"
send "\n"
expect "Author"
send "\n"
expect "Vue build"
send "\n"
expect "Install vue-router"
send "\n"
expect "ESLint"
send "\n"
expect "ESLint preset"
send "\[B"
expect "Airbnb"
send "\n"
expect "unit tests"
send "\n"
expect "test runner"
send "\n"
expect "e2e tests"
send "\n"
expect "npm install"
send "\[B"
send "\[B"
expect "No"
send "\n"
expect eof
26 changes: 26 additions & 0 deletions tests/airbnb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

testname=$1

if [[ -z $testname ]]; then
echo "No test name given"
exit -1;
fi

if [[ "$testname" == *\/* ]] || [[ "$testname" == *\\* ]]; then
echo "Invalid test name"
exit -1;
fi

rm -Rf "$testname"

expect "$testname.expect" "$testname"

echo "Testing $testname"
cd $testname
npm install
npm run lint -- --fix
npm run lint
npm test
npm run build
cd ..
29 changes: 29 additions & 0 deletions tests/default.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set testname [lindex $argv 0];
spawn ../node_modules/.bin/vue init .. $testname

expect "Project name"
send "\n"
expect "Project description"
send "\n"
expect "Author"
send "\n"
expect "Vue build"
send "\n"
expect "Install vue-router"
send "\n"
expect "ESLint"
send "\n"
expect "ESLint preset"
send "\n"
expect "unit tests"
send "\n"
expect "test runner"
send "\n"
expect "e2e tests"
send "\n"
expect "npm install"
send "\[B"
send "\[B"
expect "No"
send "\n"
expect eof
26 changes: 26 additions & 0 deletions tests/default.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

testname=$1

if [[ -z $testname ]]; then
echo "No test name given"
exit -1;
fi

if [[ "$testname" == *\/* ]] || [[ "$testname" == *\\* ]]; then
echo "Invalid test name"
exit -1;
fi

rm -Rf "$testname"

expect "$testname.expect" "$testname"

echo "Testing $testname"
cd $testname
npm install
npm run lint -- --fix
npm run lint
npm test
npm run build
cd ..
30 changes: 30 additions & 0 deletions tests/no-eslint-karma.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set testname [lindex $argv 0];
spawn ../node_modules/.bin/vue init .. $testname

expect "Project name"
send "\n"
expect "Project description"
send "\n"
expect "Author"
send "\n"
expect "Vue build"
send "\n"
expect "Install vue-router"
send "\n"
expect "ESLint"
send "n"
send "\n"
expect "unit tests"
send "\n"
expect "test runner"
send "\n"
expect "e2e tests"
send "\[B"
expect "Karma"
send "\n"
expect "npm install"
send "\[B"
send "\[B"
expect "No"
send "\n"
expect eof
24 changes: 24 additions & 0 deletions tests/no-eslint-karma.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

testname=$1

if [[ -z $testname ]]; then
echo "No test name given"
exit -1;
fi

if [[ "$testname" == *\/* ]] || [[ "$testname" == *\\* ]]; then
echo "Invalid test name"
exit -1;
fi

rm -Rf "$testname"

expect "$testname.expect" "$testname"

echo "Testing $testname"
cd $testname
npm install
npm test
npm run build
cd ..
30 changes: 30 additions & 0 deletions tests/no-router.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set testname [lindex $argv 0];
spawn ../node_modules/.bin/vue init .. $testname

expect "Project name"
send "\n"
expect "Project description"
send "\n"
expect "Author"
send "\n"
expect "Vue build"
send "\n"
expect "Install vue-router"
send "n"
send "\n"
expect "ESLint"
send "\n"
expect "ESLint preset"
send "\n"
expect "unit tests"
send "\n"
expect "test runner"
send "\n"
expect "e2e tests"
send "\n"
expect "npm install"
send "\[B"
send "\[B"
expect "No"
send "\n"
expect eof
26 changes: 26 additions & 0 deletions tests/no-router.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

testname=$1

if [[ -z $testname ]]; then
echo "No test name given"
exit -1;
fi

if [[ "$testname" == *\/* ]] || [[ "$testname" == *\\* ]]; then
echo "Invalid test name"
exit -1;
fi

rm -Rf "$testname"

expect "$testname.expect" "$testname"

echo "Testing $testname"
cd $testname
npm install
npm run lint -- --fix
npm run lint
npm test
npm run build
cd ..