From 86dd7fae91f71108313022f90f46c4560f78ffee Mon Sep 17 00:00:00 2001 From: louistiti Date: Sat, 3 Apr 2021 11:43:55 +0800 Subject: [PATCH] chore: force Jest to exit if a process is still running --- package.json | 6 +++--- test/unit/server/core/server.spec.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d51bdfd98..4ba062fd6 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,10 @@ "scripts": { "lint": "babel-node scripts/lint.js", "test": "npm run test:json && npm run test:unit && npm run test:e2e", - "test:unit": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --silent --projects test/unit/unit.jest.json && npm run train expressions", + "test:unit": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --forceExit --silent --projects test/unit/unit.jest.json && npm run train expressions", "test:e2e": "npm run test:e2e:nlp-modules && npm run test:e2e:modules", - "test:e2e:modules": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --silent --verbose --projects test/e2e/modules/e2e.modules.jest.json && npm run train expressions", - "test:e2e:nlp-modules": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --silent --verbose --setupTestFrameworkScriptFile=./test/paths.setup.js test/e2e/nlp-modules.spec.js && npm run train expressions", + "test:e2e:modules": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --forceExit --silent --verbose --projects test/e2e/modules/e2e.modules.jest.json && npm run train expressions", + "test:e2e:nlp-modules": "npm run train expressions:en && cross-env PIPENV_PIPFILE=bridges/python/Pipfile jest --forceExit --silent --verbose --setupTestFrameworkScriptFile=./test/paths.setup.js test/e2e/nlp-modules.spec.js && npm run train expressions", "test:json": "jest --silent --projects test/json/json.jest.json", "test:module": "babel-node scripts/test-module.js", "setup:offline": "babel-node scripts/setup-offline/setup-offline.js", diff --git a/test/unit/server/core/server.spec.js b/test/unit/server/core/server.spec.js index bc94541f5..427674abb 100644 --- a/test/unit/server/core/server.spec.js +++ b/test/unit/server/core/server.spec.js @@ -101,10 +101,12 @@ describe('server', () => { ee.emit('recognize', 'blob') }, 150) - setTimeout(() => { + setTimeout(async () => { expect(console.log.mock.calls[0][1]).toBe('ASR') console.log = jest.fn() + await server.httpServer.close() + done() }, 200) })