Skip to content

Commit 3bb5d20

Browse files
committed
chore: fix tests
1 parent d581176 commit 3bb5d20

File tree

5 files changed

+9
-24
lines changed

5 files changed

+9
-24
lines changed
File renamed without changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"build": "rm -rf lib && tsc",
1616
"example:simple": "nodemon",
1717
"example:auth": "nodemon --config nodemon.auth.json",
18-
"test": "jest --config ./test/jest.json",
18+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config ./jest.json --runInBand --detectOpenHandles",
1919
"lint": "eslint './**/*.ts'",
2020
"check:all": "yarn lint && yarn build && yarn test",
2121
"release": "semantic-release"
@@ -51,6 +51,7 @@
5151
"devDependencies": {
5252
"@adminjs/mongoose": "^3.0.1",
5353
"@commitlint/config-conventional": "^17.4.4",
54+
"@jest/globals": "^29.5.0",
5455
"@semantic-release/git": "^9.0.0",
5556
"@types/express": "^4.17.17",
5657
"@types/express-formidable": "^1.2.0",
@@ -60,7 +61,6 @@
6061
"@typescript-eslint/parser": "^5.53.0",
6162
"adminjs": "^6.0.0",
6263
"commitlint": "^17.4.4",
63-
"dotenv-cli": "^7.1.0",
6464
"eslint": "^8.35.0",
6565
"eslint-config-airbnb-base": "^15.0.0",
6666
"eslint-config-prettier": "^8.6.0",

test/plugin.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import AdminJS from "adminjs";
1+
import { AdminJS } from "adminjs";
22
import express from "express";
3+
import { jest } from "@jest/globals";
4+
35
import { buildRouter } from "../src/buildRouter";
46

7+
jest.useFakeTimers();
8+
59
describe("plugin", () => {
610
describe(".buildRouter", () => {
711
it("returns an express router when AdminJS instance given as an argument", () => {

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"noImplicitThis": true,
2020
"moduleResolution": "nodenext",
2121
"baseUrl": "./",
22-
"typeRoots": ["./src/typings", "./node_modules/@types"]
22+
"typeRoots": ["./src/typings", "./node_modules/@types"],
23+
"allowJs": true
2324
},
2425
"exclude": ["lib", "types", "test", "examples"]
2526
}

yarn.lock

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5693,26 +5693,6 @@ dot-prop@^5.1.0, dot-prop@^5.2.0:
56935693
dependencies:
56945694
is-obj "^2.0.0"
56955695

5696-
dotenv-cli@^7.1.0:
5697-
version "7.1.0"
5698-
resolved "https://registry.yarnpkg.com/dotenv-cli/-/dotenv-cli-7.1.0.tgz#9ff360f7d1de72389027d4d9e9deccb0ef151c5e"
5699-
integrity sha512-motytjZFQB3ZtGTIN4c0vnFgv4kuNZ2WxVnGY6PVFiygCzkm3IFBBguDUzezd9HgNA0OYYd6vNCWlozs0Q1Zxg==
5700-
dependencies:
5701-
cross-spawn "^7.0.3"
5702-
dotenv "^16.0.0"
5703-
dotenv-expand "^10.0.0"
5704-
minimist "^1.2.6"
5705-
5706-
dotenv-expand@^10.0.0:
5707-
version "10.0.0"
5708-
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37"
5709-
integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==
5710-
5711-
dotenv@^16.0.0:
5712-
version "16.0.3"
5713-
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
5714-
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
5715-
57165696
dotenv@^5.0.1:
57175697
version "5.0.1"
57185698
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef"

0 commit comments

Comments
 (0)