end-to-end testing setup

This commit is contained in:
Hayden 2022-09-03 18:42:03 -08:00
parent b4eb7d8ddc
commit ad4c8c9ab4
41 changed files with 544 additions and 313 deletions

4
frontend/test/config.ts Normal file
View file

@ -0,0 +1,4 @@
export const PORT = "7745";
export const HOST = "http://127.0.0.1";
export const BASE_URL = HOST + ":" + PORT;

20
frontend/test/setup.ts Normal file
View file

@ -0,0 +1,20 @@
import { exec } from 'child_process';
import * as config from './config';
export const setup = () => {
console.log('Starting Client Tests');
console.log({
PORT: config.PORT,
HOST: config.HOST,
BASE_URL: config.BASE_URL,
});
};
export const teardown = () => {
if (process.env.TEST_SHUTDOWN_API_SERVER) {
const pc = exec('pkill -SIGTERM api'); // Kill background API process
pc.stdout.on('data', data => {
console.log(`stdout: ${data}`);
});
}
};

View file

@ -0,0 +1,8 @@
/// <reference types="vitest" />
import { defineConfig } from "vite";
export default defineConfig({
test: {
globalSetup: "./test/setup.ts",
},
});