fix path and tests

This commit is contained in:
StarAppeal
2025-09-24 06:10:52 +02:00
parent 5e9f3494e7
commit 2796c465c0
7 changed files with 845 additions and 6388 deletions
+3
View File
@@ -130,3 +130,6 @@ dist
.yarn/build-state.yml .yarn/build-state.yml
.yarn/install-state.gz .yarn/install-state.gz
.pnp.* .pnp.*
tests//*.js/*.js.map
+816 -6352
View File
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -1,13 +1,14 @@
{ {
"name": "matrix-backend", "name": "matrix-backend",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "type": "commonjs",
"main": "dist/index.js",
"scripts": { "scripts": {
"start": "tsc && cross-env NODE_ENV=development node dist/src/index.js", "start": "cross-env NODE_ENV=development ts-node-dev --respawn --transpile-only src/index.ts",
"clean": "rimraf dist", "clean": "rimraf dist",
"build": "npm run clean & tsc", "build": "tsc --project tsconfig.json",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest run --watch", "test:watch": "vitest watch",
"test:coverage": "vitest run --coverage" "test:coverage": "vitest run --coverage"
}, },
"keywords": [], "keywords": [],
@@ -43,6 +44,9 @@
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"supertest": "^7.1.4", "supertest": "^7.1.4",
"ts-node-dev": "^2.0.0",
"vite": "^7.1.7",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4" "vitest": "^3.2.4"
} }
} }
-1
View File
@@ -15,7 +15,6 @@ async function bootstrap() {
throw new Error("CRITICAL ERROR: SPOTIFY_CLIENT_SECRET environment variable is not set."); throw new Error("CRITICAL ERROR: SPOTIFY_CLIENT_SECRET environment variable is not set.");
} }
// Server-Instanz mit Konfiguration erstellen
const server = new Server({ const server = new Server({
port: baseConfig.port, port: baseConfig.port,
jwtSecret: SECRET_KEY, jwtSecret: SECRET_KEY,
+3 -5
View File
@@ -5,16 +5,14 @@
"esModuleInterop": true, "esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"lib": ["ES2022"],
"skipLibCheck": true, "skipLibCheck": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src",
"typeRoots": [ "typeRoots": [
"./node_modules/@types", "./node_modules/@types",
"./types" "./types"
] ]
}, },
"include": [ "include": ["src/**/*.ts"],
"src/**/*.ts", "exclude": ["node_modules", "tests"]
"tests/**/*.ts"
]
} }
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": null
},
"include": ["src/**/*.ts", "tests/**/*.ts"]
}
+6 -25
View File
@@ -1,33 +1,14 @@
// vitest.config.ts
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({ export default defineConfig({
plugins: [tsconfigPaths()],
test: { test: {
/**
* globals: true
* Das ist der wichtigste Punkt, um dein ursprüngliches Problem zu lösen.
* Diese Option weist Vitest an, die globalen APIs (describe, it, expect, vi)
* automatisch in allen Testdateien verfügbar zu machen.
*/
globals: true, globals: true,
/**
* environment: 'node'
* Dies simuliert eine Node.js-Umgebung für deine Tests.
* Es ist essenziell für Backend-Tests, da es Node.js-APIs wie `process`
* zur Verfügung stellt.
*/
environment: 'node', environment: 'node',
exclude: [
/** 'node_modules',
* setupFiles: ['./tests/setup.ts'] 'dist',
* (Optional, aber sehr nützlich) ],
* Hier kannst du eine Datei angeben, die vor ALLEN Tests einmalig ausgeführt wird.
* Perfekt, um z.B. eine Verbindung zu einer Test-Datenbank aufzubauen oder
* globale Mocks zu definieren.
* Du kannst diese Zeile erstmal auskommentieren, wenn du sie nicht brauchst.
*/
// setupFiles: ['./tests/setup.ts'],
}, },
}); });