diff --git a/.mocharc.cjs b/.mocharc.cjs index 040da39e..ef19c9e1 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -2,7 +2,7 @@ module.exports = { recursive: true, extension: ['.test.mts'], - 'node-option': ['loader=ts-node/esm', 'loader=testdouble', 'no-warnings'], + 'node-option': ['loader=ts-node/esm', 'no-warnings'], require: 'mocha.setup.mjs', reporter: 'mocha-multi', 'reporter-option': [ diff --git a/package-lock.json b/package-lock.json index 35001ea7..c9cb8512 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,8 +17,8 @@ "@myrotvorets/express-request-logger": "^1.2.0", "@myrotvorets/facex": "^2.6.1", "@myrotvorets/oav-installer": "^5.0.0", - "@myrotvorets/opentelemetry-configurator": "^7.0.0", - "@myrotvorets/otel-utils": "^0.0.10", + "@myrotvorets/opentelemetry-configurator": "^7.1.0", + "@myrotvorets/otel-utils": "^1.0.0", "@opentelemetry/api": "^1.6.0", "@opentelemetry/core": "^1.17.1", "@opentelemetry/semantic-conventions": "^1.17.1", @@ -331,9 +331,9 @@ } }, "node_modules/@myrotvorets/create-server": { - "version": "2.2.0", - "resolved": "https://npm.pkg.github.com/download/@myrotvorets/create-server/2.2.0/aa007ed074d41592e4e49bc4a14f07dff639cc3e", - "integrity": "sha512-Ho8kLyguXlrsG+wmR3jJ5ofyv7dqgwJ6KPeSyQp+TPmB6fXkgueBO7TL8Ajfvb94zeTd/advyrCUk9BL9ZaYfA==", + "version": "3.1.0", + "resolved": "https://npm.pkg.github.com/download/@myrotvorets/create-server/3.1.0/fba32470c797f851c53706923261e76fadae5198", + "integrity": "sha512-iGwK0tIXsVziMXFLEsVAYANluJy38gVw1pWdyyd4I66kfVBirWRvGWXEBUIkax+3OzVQFfTKC+G7PazWwN9QUA==", "license": "MIT", "peerDependencies": { "envalid": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -461,9 +461,9 @@ } }, "node_modules/@myrotvorets/opentelemetry-configurator": { - "version": "7.0.0", - "resolved": "https://npm.pkg.github.com/download/@myrotvorets/opentelemetry-configurator/7.0.0/9456292eadcc8f728cff7bb2d322a21496712846", - "integrity": "sha512-1Zs9mefGFrcxx3N9X1XqPSWjihlLs10tgdaGz/Uyx/JDCIu6qo9q6hDatysz+she6NzJ0IrfeANp+uu+3nNjtQ==", + "version": "7.1.0", + "resolved": "https://npm.pkg.github.com/download/@myrotvorets/opentelemetry-configurator/7.1.0/faad8996a3738d9c9d0fb63aa98fd490825130ca", + "integrity": "sha512-23cpfdKnUTlgglLIYYyZLAwqH6yUGKSceDcUl3K4/KIHzHugPF8b5f8D9dAP+qhR5k5C0axFU0w3jEBIfQYl4Q==", "license": "MIT", "dependencies": { "@myrotvorets/opentelemetry-resource-detectors": "^1.0.1", @@ -498,12 +498,12 @@ } }, "node_modules/@myrotvorets/otel-utils": { - "version": "0.0.10", - "resolved": "https://npm.pkg.github.com/download/@myrotvorets/otel-utils/0.0.10/c4a88d023db5334adc92439a113bbe0b96e484b2", - "integrity": "sha512-1s5cpfplVjKUUrJxm30+ZC5E5mH291APDtatt+KRd6Mje3yzsEQ49GWGDppg6ObjZK5/DtfBFlNF8vjGMIwwxA==", + "version": "1.0.0", + "resolved": "https://npm.pkg.github.com/download/@myrotvorets/otel-utils/1.0.0/c03c0d4716c85c3df5f3e32278df764464ee2fc2", + "integrity": "sha512-PjLl1QXT3/GF9mkwdtgBPspc7Rhe6BZ+a5wwLA1o7c3RolQ6cDW4zkN0If5HZ+EybhuM/06lMLDWi45UgMHUXw==", "license": "MIT", "dependencies": { - "@myrotvorets/create-server": "^2.2.0" + "@myrotvorets/create-server": "^3.0.0" }, "peerDependencies": { "@opentelemetry/api": "^1.6.0", diff --git a/package.json b/package.json index cc62d861..64477696 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "@myrotvorets/express-request-logger": "^1.2.0", "@myrotvorets/facex": "^2.6.1", "@myrotvorets/oav-installer": "^5.0.0", - "@myrotvorets/opentelemetry-configurator": "^7.0.0", - "@myrotvorets/otel-utils": "^0.0.10", + "@myrotvorets/opentelemetry-configurator": "^7.1.0", + "@myrotvorets/otel-utils": "^1.0.0", "@opentelemetry/api": "^1.6.0", "@opentelemetry/core": "^1.17.1", "@opentelemetry/semantic-conventions": "^1.17.1", diff --git a/src/server.mts b/src/server.mts index 291aa3f3..1c5f634d 100644 --- a/src/server.mts +++ b/src/server.mts @@ -31,7 +31,7 @@ export function configureApp(app: Express): Promise rmSync(tempDir, { force: true, recursive: true, maxRetries: 3 })); + process.once('beforeExit', () => rmSync(tempDir, { force: true, recursive: true, maxRetries: 3 })); app.use(requestDurationMiddleware, scopedContainerMiddleware, loggerMiddleware); @@ -81,9 +81,6 @@ export function createApp(): Express { export async function run(): Promise { const app = createApp(); - const container = await configureApp(app); - const env = container.resolve('environment'); - - const server = await createServer(app); - server.listen(env.PORT); + await configureApp(app); + await createServer(app); }