-
Notifications
You must be signed in to change notification settings - Fork 4
/
run-tests.sh
executable file
·59 lines (52 loc) · 1.15 KB
/
run-tests.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
53
54
55
56
57
58
59
setupNext() {
echo "Setting up Next.js"
npx next build ./tests/nextjs
}
setupPrisma() {
echo "Setting up Prisma"
npx prisma generate --schema=./tests/prisma/schema.prisma
npx prisma migrate dev --schema=./tests/prisma/schema.prisma --name init
}
# Run all tests
runAllTests() {
setupNext
setupPrisma
npm run vitest
}
# Run Next.js tests
runNextJsTests() {
setupNext
npm run vitest -t ./tests/nextjs/nextjs.test.ts
}
# Run Nest.js tests
runNestJsTests() {
npm run vitest -t ./tests/nestjs/nestjs.test.ts
}
# Run Prisma tests
runPrismaTests() {
setupPrisma
npm run vitest -t ./tests/prisma/*.test.ts
}
# Run MySQL tests
runMysqlTests() {
npm run vitest -t ./tests/mysql2.test.ts
}
# Check if a variable is passed
if [ "$1" = "express" ]; then
npm run vitest -t ./tests/express.test.ts
elif [ "$1" = "nextjs" ]; then
# Run Next.js tests without setting up
if [ "$2" = "--no-setup" ]; then
npm run vitest -t ./tests/nextjs/nextjs.test.ts
else
runNextJsTests
fi
elif [ "$1" = "nestjs" ]; then
runNestJsTests
elif [ "$1" = "prisma" ]; then
runPrismaTests
elif [ "$1" = "mysql2" ]; then
runAllTests
else
runAllTests
fi