| @@ -77,7 +77,9 @@ | ||||
|     "docs": "typedoc --out docs src", | ||||
|     "test": "jest", | ||||
|     "test:watch": "jest --watchAll", | ||||
|     "test:ci": "start-server-and-test dev http://localhost:4010/api/docs/openapi.json test", | ||||
|     "test:ci:generate_env": "ts-node scripts/create_testenv.ts", | ||||
|     "test:ci:run": "start-server-and-test dev http://localhost:4010/api/docs/openapi.json test", | ||||
|     "test:ci": "npm run test:ci:generate_env && npm run test:ci:run", | ||||
|     "seed": "ts-node ./node_modules/typeorm/cli.js schema:sync && ts-node ./node_modules/typeorm-seeding/dist/cli.js seed", | ||||
|     "openapi:export": "ts-node scripts/openapi_export.ts", | ||||
|     "licenses:export": "license-exporter --md", | ||||
| @@ -102,4 +104,4 @@ | ||||
|       "docs/*" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
| } | ||||
							
								
								
									
										37
									
								
								scripts/create_testenv.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								scripts/create_testenv.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| import consola from "consola"; | ||||
| import fs from "fs"; | ||||
| import nodemailer from "nodemailer"; | ||||
|  | ||||
|  | ||||
| nodemailer.createTestAccount((err, account) => { | ||||
|     if (err) { | ||||
|         console.error('Failed to create a testing account. ' + err.message); | ||||
|         return process.exit(1); | ||||
|     } | ||||
|  | ||||
|     const env = ` | ||||
| APP_PORT=4010 | ||||
| DB_TYPE=sqlite | ||||
| DB_HOST=bla | ||||
| DB_PORT=bla | ||||
| DB_USER=bla | ||||
| DB_PASSWORD=bla | ||||
| DB_NAME=./test.sqlite | ||||
| NODE_ENV=dev | ||||
| POSTALCODE_COUNTRYCODE=DE | ||||
| SEED_TEST_DATA=true | ||||
| MAIL_SERVER=${account.smtp.host} | ||||
| MAIL_PORT=${account.smtp.port} | ||||
| MAIL_USER=${account.user} | ||||
| MAIL_PASSWORD=${account.pass} | ||||
| MAIL_FROM=${account.user}` | ||||
|  | ||||
|     try { | ||||
|         fs.writeFileSync("./.env", env, { encoding: "utf-8" }); | ||||
|         consola.success("Exported ci env to .env"); | ||||
|     } catch (error) { | ||||
|         consola.error("Couldn't export the ci env"); | ||||
|     } | ||||
|  | ||||
| }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user