refactor(v4.0.0-alpha): beginning of a new era

This commit is contained in:
Amruth Pillai
2023-11-05 12:31:42 +01:00
parent 0ba6a444e2
commit 22933bd412
505 changed files with 81829 additions and 0 deletions

View File

@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@ -0,0 +1,19 @@
/* eslint-disable */
export default {
displayName: "server-e2e",
preset: "../../jest.preset.js",
globalSetup: "<rootDir>/src/support/global-setup.ts",
globalTeardown: "<rootDir>/src/support/global-teardown.ts",
setupFiles: ["<rootDir>/src/support/test-setup.ts"],
testEnvironment: "node",
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "js", "html"],
coverageDirectory: "../../coverage/server-e2e",
};

View File

@ -0,0 +1,24 @@
{
"name": "server-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"],
"options": {
"jestConfig": "apps/server-e2e/jest.config.ts",
"passWithNoTests": true
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/server-e2e/**/*.{js,ts}"]
}
}
},
"tags": ["backend"],
"implicitDependencies": ["server"]
}

View File

@ -0,0 +1,10 @@
import axios from "axios";
describe("GET /api/health", () => {
it("should return a status 'ok'", async () => {
const res = await axios.get(`/health`);
expect(res.status).toBe(200);
expect(res.data).toMatchObject({ status: "ok" });
});
});

View File

@ -0,0 +1,10 @@
/* eslint-disable */
var __TEARDOWN_MESSAGE__: string;
module.exports = async function () {
// Start services that that the app needs to run (e.g. database, docker-compose, etc.).
console.log("\nSetting up...\n");
// Hint: Use `globalThis` to pass variables to global teardown.
globalThis.__TEARDOWN_MESSAGE__ = "\nTearing down...\n";
};

View File

@ -0,0 +1,6 @@
/* eslint-disable */
module.exports = async function () {
// Put clean up logic here (e.g. stopping services, docker-compose, etc.).
// Hint: `globalThis` is shared between setup and teardown.
console.log(globalThis.__TEARDOWN_MESSAGE__);
};

View File

@ -0,0 +1,8 @@
import axios from "axios";
module.exports = async function () {
const serverUrl = process.env.VITE_SERVER_URL ?? "http://localhost:3000";
axios.defaults.withCredentials = true;
axios.defaults.baseURL = `${serverUrl}/api`;
};

View File

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"esModuleInterop": true
}
}

View File

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.ts"]
}