forked from kriasoft/graphql-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
53 lines (46 loc) · 1.2 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* SPDX-FileCopyrightText: 2014-present Kriasoft */
/* SPDX-License-Identifier: MIT */
import envars from "envars";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
envars.config({ env: process.env.APP_ENV ?? "local" });
/**
* Jest configuration
* https://jestjs.io/docs/configuration
*
* @type {import("jest").Config}
*/
export default {
cacheDirectory: "./.cache/jest",
testMatch: ["**/*.test.ts", "**/*.test.tsx"],
projects: [
{
displayName: "api",
rootDir: getRootDir("api"),
testEnvironment: "jest-environment-node",
transform: { "\\.(js|ts)$": ["babel-jest", { rootMode: "upward" }] },
transformIgnorePatterns: [`/node_modules/(?!(${getESModules()})/)`],
setupFiles: ["<rootDir>/utils/setupTests.ts"],
},
],
};
function getRootDir(name) {
return path.join(fileURLToPath(import.meta.url), "..", name);
}
function getESModules() {
return [
"@sindresorhus/is",
"@szmarczak/http-timer",
"cacheable-lookup",
"cacheable-request",
"form-data-encoder",
"got",
"lodash-es",
"lowercase-keys",
"mimic-response",
"nanoid",
"normalize-url",
"p-cancelable",
"responselike",
].join("|");
}