1
0
mirror of synced 2026-02-03 18:01:02 -05:00

Compare commits

...

28 Commits

Author SHA1 Message Date
Dillon Raphael
debdf73c09 try the process exit and calling seed function directly 2022-09-12 16:09:45 -04:00
Dillon Raphael
0b314f676a try db push --force-reset for prisma util method 2022-09-12 16:03:36 -04:00
Dillon Raphael
d6b755c55d try just prisma db seed and the method 2022-09-12 15:56:55 -04:00
Dillon Raphael
35037409bd comment out await seed in test file 2022-09-12 15:49:04 -04:00
Dillon Raphael
9216fcf490 try calling seed function in seed file 2022-09-12 15:46:25 -04:00
Dillon Raphael
da1f9ccc66 reset database outside of 2022-09-12 15:40:29 -04:00
Dillon Raphael
cea5a3bde3 try force reset for 2022-09-12 15:32:28 -04:00
Dillon Raphael
b1a3ed446f add process.exit 0 2022-09-12 15:27:26 -04:00
Dillon Raphael
ecfb545143 add back seed/prisma property 2022-09-12 15:21:16 -04:00
Dillon Raphael
5db22d1b2b seed in server mode for auth test 2022-09-12 15:11:09 -04:00
Dillon Raphael
5aa4a6fd5f try auth test without dev mode 2022-09-12 15:03:15 -04:00
Dillon Raphael
2b4fe66c2e remove process exit 2022-09-12 14:53:58 -04:00
Dillon Raphael
bb8a943bfd try catch seed 2022-09-12 14:46:22 -04:00
Dillon Raphael
aea690007b test adding proces.exit(0) in seed file 2022-09-12 14:36:44 -04:00
Dillon Raphael
3400483a18 set shell bash for test 2022-09-12 14:19:44 -04:00
Dillon Raphael
7021c3951f try require resolve 2022-09-12 14:03:51 -04:00
Dillon Raphael
441568a2dc test path.resolve 2022-09-12 13:47:44 -04:00
Dillon Raphael
0146f65550 another test 2022-09-12 13:41:04 -04:00
Dillon Raphael
1cefce3f81 console logs prisma bin 2022-09-12 13:32:47 -04:00
Dillon Raphael
7cc0f530f6 try and get current working directory path for windows 2022-09-12 13:27:55 -04:00
Dillon Raphael
74d9b2cd37 remove process.cwd from which 2022-09-12 13:14:27 -04:00
Dillon Raphael
cc0d0c7c9f revert auth integration test 2022-09-12 12:50:57 -04:00
Siddharth Suresh
43ed45ff58 Update main.yml 2022-09-12 11:03:00 +05:30
Siddharth Suresh
305eb50c4e Update main.yml 2022-09-11 23:31:21 +05:30
Siddharth Suresh
6fa48684f4 fix auth 2022-09-11 23:19:21 +05:30
Siddharth Suresh
c46ef8d360 Update main.yml 2022-09-11 23:10:27 +05:30
Siddharth Suresh
7c121a6901 Update main.yml 2022-09-11 22:53:15 +05:30
Siddharth Suresh
d804b1a1a3 Update main.yml 2022-09-11 22:19:50 +05:30
7 changed files with 155 additions and 41 deletions

View File

@@ -1,5 +1,3 @@
# https://github.com/vercel/next.js/commits/canary/.github/workflows/build_test_deploy.yml
name: CI
on:
@@ -16,14 +14,8 @@ env:
jobs:
lint:
name: "Lint: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
node_version:
- 16
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
@@ -32,7 +24,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
node-version: 16
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -48,14 +40,8 @@ jobs:
run: pnpm lint -- --api="http://127.0.0.1:9080"
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
node_version:
- 16
name: Build - ${{ matrix.os }}
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
@@ -64,7 +50,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
node-version: 16
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm manypkg check
@@ -78,19 +64,17 @@ jobs:
- name: Build Apps
run: pnpm build:apps -- --api="http://127.0.0.1:9080"
test:
name: "Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
Unit-Tests:
name: "Unit Test: ${{ matrix.os }} (node@16)"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
node_version:
- 16
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
NODE_VERSION: 16
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -100,6 +84,74 @@ jobs:
with:
version: 6.32.6
- name: Setup node@16
uses: actions/setup-node@v2
with:
node-version: 16
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
shell: bash
- run: pnpm manypkg check
shell: bash
- name: Turborepo local server
uses: felixmosh/turborepo-gh-artifacts@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}
- name: Build
run: pnpm build -- --api="http://127.0.0.1:9080"
shell: bash
- name: Test Packages
run: pnpm test -- --filter=./packages/*
shell: bash
- name: Test Apps
run: pnpm test -- --filter=./apps/*
shell: bash
find-integration-tests:
name: "Find Integration Tests"
runs-on: ubuntu-latest
outputs:
folders: ${{ steps.set-matrix.outputs.folders }}
steps:
- uses: actions/checkout@v2
- id: set-matrix
name: "Find all folders"
shell: bash
run: |
cd ./integration-tests
tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring)'
folders=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring)')
echo "::set-output name=folders::$folders"
Integration-Tests:
name: "Integration Test: ${{matrix.folder}} @ ${{ matrix.os }} "
needs: [find-integration-tests]
strategy:
matrix:
folder: ${{fromJSON(needs.find-integration-tests.outputs.folders)}}
os:
- ubuntu-latest
- windows-latest
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- run: echo ${{matrix.folder}}
- name: Checkout
uses: actions/checkout@v3
- name: Setup PNPM
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 6.32.6
- name: Setup node@${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v2
with:
@@ -123,6 +175,6 @@ jobs:
run: pnpm build -- --api="http://127.0.0.1:9080"
shell: bash
- name: Test
run: pnpm test -- --api="http://127.0.0.1:9080"
- name: Test Packages
run: pnpm test -- --filter=./integration-tests/${{matrix.folder}}
shell: bash

View File

@@ -2,6 +2,9 @@
"name": "test-auth",
"version": "0.0.0",
"private": true,
"prisma": {
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
},
"scripts": {
"start:dev": "pnpm run prisma:start && next dev",
"test": "pnpm run prisma:start && vitest run",
@@ -9,7 +12,8 @@
"start": "next start",
"lint": "next lint",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
"prisma:start": "prisma generate && prisma migrate deploy",
"prisma:start": "prisma generate && prisma migrate dev && pnpm run prisma:seed",
"prisma:seed": "prisma db seed",
"prisma:studio": "prisma studio"
},
"dependencies": {

View File

@@ -6,13 +6,19 @@ const seed = async () => {
const hashedPassword = await SecurePassword.hash("abcd1234")
await prisma.user.create({
data: {
email: "test@test.com",
hashedPassword,
role: "user",
},
})
await prisma.user
.create({
data: {
email: "test@test.com",
hashedPassword,
role: "user",
},
})
.catch(console.error)
process.exit(0)
}
seed()
export default seed

View File

@@ -128,7 +128,7 @@ describe("Auth Tests", () => {
try {
appPort = await findPort()
app = await launchApp(appDir, appPort, {cwd: process.cwd()})
await seed()
// await seed()
} catch (error) {
console.log(error)
}

View File

@@ -47,6 +47,7 @@
"prompts": "2.4.2",
"resolve-cwd": "3.0.0",
"resolve-from": "5.0.0",
"shelljs": "0.8.5",
"superjson": "1.9.1",
"supports-color": "8.1.1",
"ts-node": "10.7.0",
@@ -69,6 +70,7 @@
"@types/prompts": "2.0.14",
"@types/react": "18.0.17",
"@types/react-dom": "17.0.14",
"@types/shelljs": "0.8.11",
"@types/test-listen": "1.1.0",
"@types/watchpack": "1.1.1",
"express": "4.17.3",

View File

@@ -35,9 +35,11 @@ export const enhancePrisma = <TPrismaClientCtor extends Constructor>(
"You are calling db.$reset() in a production environment. We think you probably didn't mean to do that, so we are throwing this error instead of destroying your life's work.",
)
}
const prismaBin = which(process.cwd()).sync("prisma")
await new Promise((res, rej) => {
const process = spawn(prismaBin, ["migrate", "reset", "--force", "--skip-generate"], {
const process = spawn(prismaBin, ["db", "push", "--force-reset"], {
stdio: "ignore",
})
process.on("exit", (code) => (code === 0 ? res(0) : rej(code)))

56
pnpm-lock.yaml generated
View File

@@ -665,6 +665,7 @@ importers:
"@types/prompts": 2.0.14
"@types/react": 18.0.17
"@types/react-dom": 17.0.14
"@types/shelljs": 0.8.11
"@types/test-listen": 1.1.0
"@types/watchpack": 1.1.1
arg: 5.0.1
@@ -692,6 +693,7 @@ importers:
react: 18.2.0
resolve-cwd: 3.0.0
resolve-from: 5.0.0
shelljs: 0.8.5
superjson: 1.9.1
supports-color: 8.1.1
test-listen: 1.1.0
@@ -728,6 +730,7 @@ importers:
prompts: 2.4.2
resolve-cwd: 3.0.0
resolve-from: 5.0.0
shelljs: 0.8.5
superjson: 1.9.1
supports-color: 8.1.1
ts-node: 10.7.0_typescript@4.6.3
@@ -749,6 +752,7 @@ importers:
"@types/prompts": 2.0.14
"@types/react": 18.0.17
"@types/react-dom": 17.0.14
"@types/shelljs": 0.8.11
"@types/test-listen": 1.1.0
"@types/watchpack": 1.1.1
express: 4.17.3_supports-color@8.1.1
@@ -3235,6 +3239,7 @@ packages:
semver: 5.7.1
transitivePeerDependencies:
- supports-color
dev: false
/@babel/preset-flow/7.17.12_@babel+core@7.18.2:
resolution:
@@ -5080,7 +5085,7 @@ packages:
}
dependencies:
"@types/minimatch": 3.0.5
"@types/node": 17.0.24
"@types/node": 18.7.13
/@types/graceful-fs/4.1.5:
resolution:
@@ -5302,7 +5307,6 @@ packages:
{
integrity: sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==,
}
dev: true
/@types/nodemailer/6.4.4:
resolution:
@@ -5516,6 +5520,16 @@ packages:
"@types/mime": 1.3.2
"@types/node": 17.0.24
/@types/shelljs/0.8.11:
resolution:
{
integrity: sha512-x9yaMvEh5BEaZKeVQC4vp3l+QoFj3BXcd4aYfuKSzIIyihjdVARAadYy3SMNIz0WCCdS2vB9JL/U6GQk5PaxQw==,
}
dependencies:
"@types/glob": 7.2.0
"@types/node": 18.7.13
dev: true
/@types/stack-utils/2.0.1:
resolution:
{
@@ -5721,6 +5735,7 @@ packages:
typescript: 4.6.3
transitivePeerDependencies:
- supports-color
dev: false
/@typescript-eslint/experimental-utils/5.28.0_hrkuebk64jiu2ut2d2sm4oylnu:
resolution:
@@ -9699,6 +9714,7 @@ packages:
transitivePeerDependencies:
- eslint-import-resolver-webpack
- supports-color
dev: false
/eslint-config-next/12.3.0_hrkuebk64jiu2ut2d2sm4oylnu:
resolution:
@@ -9736,6 +9752,7 @@ packages:
hasBin: true
peerDependencies:
eslint: ">=7.0.0"
dev: false
/eslint-config-prettier/8.5.0_eslint@7.32.0:
resolution:
@@ -11704,6 +11721,14 @@ packages:
has: 1.0.3
side-channel: 1.0.4
/interpret/1.4.0:
resolution:
{
integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==,
}
engines: {node: ">= 0.10"}
dev: false
/ip-regex/4.3.0:
resolution:
{
@@ -12408,7 +12433,7 @@ packages:
pretty-format: 27.5.1
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.7.0_typescript@4.6.3
ts-node: 10.7.0_fxg3r7oju3tntkxsvleuiot4fa
transitivePeerDependencies:
- bufferutil
- canvas
@@ -15998,6 +16023,16 @@ packages:
source-map: 0.6.1
tslib: 2.4.0
/rechoir/0.6.2:
resolution:
{
integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==,
}
engines: {node: ">= 0.10"}
dependencies:
resolve: 1.22.0
dev: false
/redent/3.0.0:
resolution:
{
@@ -16700,6 +16735,19 @@ packages:
}
dev: true
/shelljs/0.8.5:
resolution:
{
integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==,
}
engines: {node: ">=4"}
hasBin: true
dependencies:
glob: 7.2.0
interpret: 1.4.0
rechoir: 0.6.2
dev: false
/side-channel/1.0.4:
resolution:
{
@@ -17742,7 +17790,6 @@ packages:
typescript: 4.6.3
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: false
/ts-node/10.7.0_typescript@4.6.3:
resolution:
@@ -17775,6 +17822,7 @@ packages:
typescript: 4.6.3
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: false
/ts-node/10.9.1_kakyiqi62sfonxvjmz3ft5vt7y:
resolution: