File tree Expand file tree Collapse file tree 10 files changed +77
-87
lines changed
mysql-multi-project-schema Expand file tree Collapse file tree 10 files changed +77
-87
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ echo "Waiting 10s for db to start..." && sleep 10
1818
1919# Push schema and seed
2020drizzle-kit generate:mysql --config=./test/mysql-multi-project-schema/drizzle.config.ts
21- NODE_OPTIONS=' --import tsx'
2221tsx ./test/mysql-multi-project-schema/migrator.ts
2322
2423if vitest run -c ../utils/vitest.config.ts ./test/mysql-multi-project-schema/index.test.ts; then
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ echo "Waiting 5s for db to start..." && sleep 5
2121
2222# Push schema and seed
2323drizzle-kit generate:pg --config=./test/pg-multi-project-schema/drizzle.config.ts
24- NODE_OPTIONS=' --import tsx'
2524tsx ./test/pg-multi-project-schema/migrator.ts
2625
2726if vitest run -c ../utils/vitest.config.ts ./test/pg-multi-project-schema/index.test.ts; then
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ echo "Waiting 5s for db to start..." && sleep 5
2121
2222# Push schema and seed
2323drizzle-kit generate:pg --config=./test/pg/drizzle.config.ts
24- NODE_OPTIONS=' --import tsx'
2524tsx ./test/pg/migrator.ts
2625
2726if vitest run -c ../utils/vitest.config.ts ./test/pg/index.test.ts; then
Original file line number Diff line number Diff line change @@ -7,11 +7,8 @@ echo "Running SQLite tests."
77rm -f db.sqlite
88
99drizzle-kit generate:sqlite --config=./test/sqlite/drizzle.config.ts
10- NODE_OPTIONS=' --import tsx'
1110tsx ./test/sqlite/migrator.ts
1211
13- vitest run -c ../utils/vitest.config.ts ./test/sqlite/index.test.ts
14-
1512if vitest run -c ../utils/vitest.config.ts ./test/sqlite/index.test.ts; then
1613 rm -f db.sqlite
1714else
Original file line number Diff line number Diff line change 3939 "build" : " tsc" ,
4040 "dev" : " tsc -w" ,
4141 "clean" : " rm -rf dist" ,
42- "init:db" : " test/init.sh" ,
43- "mysql" : " pnpm init:db && test/mysql/test.sh" ,
44- "postgres" : " pnpm init:db && test/postgresql/test.sh" ,
45- "sqlite" : " test/sqlite/test.sh" ,
46- "test:containers" : " test/test.sh" ,
47- "test" : " test/test.sh"
42+ "test" : " pnpm test:mysql && pnpm test:sqlite && pnpm test:pg" ,
43+ "test:mysql" : " pnpm clean && ./test/mysql/test.sh" ,
44+ "test:pg" : " pnpm clean && ./test/postgresql/test.sh" ,
45+ "test:sqlite" : " pnpm clean && ./test/sqlite/test.sh"
4846 },
4947 "dependencies" : {
5048 "@auth/core" : " workspace:*"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -eu
33
4- echo " Waiting 5s for db to start... "
5- sleep 5
4+ # Init MySQL container
5+ echo " Initializing container for MySQL tests "
66
7+ MYSQL_DATABASE=next-auth
8+ MYSQL_ROOT_PASSWORD=password
9+ MYSQL_CONTAINER_NAME=next-auth-mysql-test
10+
11+ function startDatabase {
12+ docker run -d --rm \
13+ -e MYSQL_DATABASE=${MYSQL_DATABASE} \
14+ -e MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} \
15+ --name " ${MYSQL_CONTAINER_NAME} " \
16+ -p 3306:3306 \
17+ mysql:8 --default-authentication-plugin=mysql_native_password
18+
19+ echo " Waiting 5s for db to start..."
20+ sleep 5
21+ }
22+
23+ startDatabase
724echo " Started running MySQL tests with default models."
8- vitest run -c ../utils/vitest.config.ts mysql/index.test.ts
25+ if vitest run -c ../utils/vitest.config.ts mysql/index.test.ts; then
26+ docker stop ${MYSQL_CONTAINER_NAME}
27+ else
28+ docker stop ${MYSQL_CONTAINER_NAME} && exit 1
29+ fi
930echo " Finished running MySQL tests with default models."
1031
32+ startDatabase
1133echo " Started running MySQL tests with custom models."
12- CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts mysql/index.custom.test.ts
34+ if CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts mysql/index.custom.test.ts; then
35+ docker stop ${MYSQL_CONTAINER_NAME}
36+ else
37+ docker stop ${MYSQL_CONTAINER_NAME} && exit 1
38+ fi
1339echo " Finished running MySQL tests with custom models."
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -eu
33
4- echo " Waiting 5s for db to start... "
5- sleep 5
4+ # Init PostgreSQL container
5+ echo " Initializing container for PostgreSQL tests "
66
7+ PGUSER=nextauth
8+ PGDATABASE=nextauth
9+ PG_CONTAINER_NAME=next-auth-postgres-test
10+
11+ function startDatabase {
12+ docker run -d --rm \
13+ -e POSTGRES_USER=${PGUSER} \
14+ -e POSTGRES_DB=${PGDATABASE} \
15+ -e POSTGRES_HOST_AUTH_METHOD=trust \
16+ --name " ${PG_CONTAINER_NAME} " \
17+ -p 5432:5432 \
18+ postgres:13.3
19+
20+ echo " Waiting 5s for db to start..."
21+ sleep 5
22+ }
23+
24+ startDatabase
725echo " Started running PostgreSQL tests with default models."
8- vitest run -c ../utils/vitest.config.ts postgresql/index.test.ts
26+ if vitest run -c ../utils/vitest.config.ts postgresql/index.test.ts; then
27+ docker stop ${PG_CONTAINER_NAME}
28+ else
29+ docker stop ${PG_CONTAINER_NAME} && exit 1
30+ fi
931echo " Finished running PostgreSQL tests with default models."
1032
33+ startDatabase
1134echo " Started running PostgreSQL tests with custom models."
12- CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts postgresql/index.custom.test.ts
35+ if CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts postgresql/index.custom.test.ts; then
36+ docker stop ${PG_CONTAINER_NAME}
37+ else
38+ docker stop ${PG_CONTAINER_NAME} && exit 1
39+ fi
1340echo " Finished running PostgreSQL tests with custom models."
Original file line number Diff line number Diff line change @@ -4,11 +4,21 @@ set -eu
44rm -f test/sqlite/dev.db
55
66echo " Started running SQLite tests with default models."
7- vitest run -c ../utils/vitest.config.ts sqlite/index.test.ts
7+ if vitest run -c ../utils/vitest.config.ts sqlite/index.test.ts; then
8+ rm -f db.sqlite
9+ else
10+ rm -f db.sqlite && exit 1
11+ fi
812echo " Finished running SQLite tests with default models."
913
1014rm -f test/sqlite/dev.db
1115
1216echo " Started running SQLite tests with custom models."
13- CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts sqlite/index.custom.test.ts
17+ if CUSTOM_MODEL=1 vitest run -c ../utils/vitest.config.ts sqlite/index.custom.test.ts; then
18+ rm -f db.sqlite
19+ else
20+ rm -f db.sqlite && exit 1
21+ fi
1422echo " Finished running SQLite tests with custom models."
23+
24+ rm -f test/sqlite/dev.db
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments