From d423d78f2a0c6fe2defc1020f5466dc06bdcce4c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 12 May 2021 14:32:01 +0200 Subject: [PATCH] esm: fix jest not running following 82ab0b963c85fdfea4205bd9d931c8bcbf9b5af6 --- jest.config.js | 3 ++- package.json | 2 ++ src/Application.ts | 8 ++++---- yarn.lock | 5 +++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/jest.config.js b/jest.config.js index e168c21..e0a3f5c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { globals: { 'ts-jest': { tsconfig: 'tsconfig.test.json', @@ -17,4 +17,5 @@ module.exports = { ], testEnvironment: 'node', testTimeout: 60000, + resolver: "jest-ts-webcompat-resolver", }; diff --git a/package.json b/package.json index de2ce91..eb0b6ca 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,8 @@ "eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-svelte3": "^3.1.2", "jest": "^26.1.0", + "jest-resolve": "^26.6.2", + "jest-ts-webcompat-resolver": "^1.0.0", "maildev": "^1.1.0", "node-fetch": "^2.6.0", "nodemon": "^2.0.6", diff --git a/src/Application.ts b/src/Application.ts index c7e406c..f9f8e7b 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -18,7 +18,7 @@ import Extendable from "./Extendable.js"; import {BadRequestError, HttpError, NotFoundHttpError, ServerError, ServiceUnavailableHttpError} from "./HttpError.js"; import {logger, loggingContextMiddleware} from "./Logger.js"; import SecurityError from "./SecurityError.js"; -import {Type} from "./Utils.js"; +import {doesFileExist, Type} from "./Utils.js"; import WebSocketListener from "./WebSocketListener.js"; import TemplateError = nunjucks.lib.TemplateError; @@ -69,7 +69,7 @@ export default abstract class Application implements Extendable { + return !await doesFileExist('node_modules/swaf'); } public isReady(): boolean { diff --git a/yarn.lock b/yarn.lock index b67de23..e4ce680 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4347,6 +4347,11 @@ jest-snapshot@^26.6.2: pretty-format "^26.6.2" semver "^7.3.2" +jest-ts-webcompat-resolver@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/jest-ts-webcompat-resolver/-/jest-ts-webcompat-resolver-1.0.0.tgz#a554eb77446e1a8d2aabb810d6302bffaa00095c" + integrity sha512-BFoaU7LeYqZNnTYEr6iMRf87xdCQntNc/Wk8YpzDBcuz+CIZ0JsTtzuMAMnKiEgTRTC1wRWLUo2RlVjVijBcHQ== + jest-util@^26.1.0, jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"