back to jest, currently has the best experience
This commit is contained in:
18
jest.config.js
Normal file
18
jest.config.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||||
|
const config = {
|
||||||
|
transform: {
|
||||||
|
"^.+\\.tsx?$": [
|
||||||
|
"esbuild-jest",
|
||||||
|
{
|
||||||
|
format: "esm",
|
||||||
|
sourcemap: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
moduleNameMapper: {
|
||||||
|
"(^\\./.+)\\.js$": "$1",
|
||||||
|
},
|
||||||
|
extensionsToTreatAsEsm: [".ts", ".tsx"],
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
23
package.json
23
package.json
@@ -17,8 +17,8 @@
|
|||||||
"lint": "eslint --ext js,ts,tsx .",
|
"lint": "eslint --ext js,ts,tsx .",
|
||||||
"lint-fix": "pnpm lint -- --fix",
|
"lint-fix": "pnpm lint -- --fix",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"test": "vitest",
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
||||||
"coverage": "vitest --coverage",
|
"coverage": "pnpm test -- --coverage",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -34,10 +34,15 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@itsmapleleaf/configs": "^1.1.2",
|
"@itsmapleleaf/configs": "^1.1.2",
|
||||||
|
"@types/jest": "^27.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
||||||
"@typescript-eslint/parser": "^5.8.0",
|
"@typescript-eslint/parser": "^5.8.0",
|
||||||
"c8": "^7.10.0",
|
"c8": "^7.10.0",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
|
"discord.js": "^13.3.1",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
|
"esbuild": "^0.14.6",
|
||||||
|
"esbuild-jest": "^0.5.0",
|
||||||
"eslint": "^8.5.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-import-resolver-typescript": "^2.5.0",
|
"eslint-import-resolver-typescript": "^2.5.0",
|
||||||
@@ -46,17 +51,13 @@
|
|||||||
"eslint-plugin-react": "^7.27.1",
|
"eslint-plugin-react": "^7.27.1",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-unicorn": "^39.0.0",
|
"eslint-plugin-unicorn": "^39.0.0",
|
||||||
"prettier": "^2.5.1",
|
"jest": "^27.4.5",
|
||||||
"should": "^13.2.3",
|
|
||||||
"typescript": "^4.5.4",
|
|
||||||
"vite": "^2.7.4",
|
|
||||||
"vitest": "^0.0.102",
|
|
||||||
"discord.js": "^13.3.1",
|
|
||||||
"dotenv": "^10.0.0",
|
|
||||||
"esbuild": "^0.14.6",
|
|
||||||
"nanoid": "^3.1.30",
|
"nanoid": "^3.1.30",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"tsup": "^5.11.6"
|
"should": "^13.2.3",
|
||||||
|
"tsup": "^5.11.6",
|
||||||
|
"typescript": "^4.5.4"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
|||||||
2156
pnpm-lock.yaml
generated
2156
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
|||||||
import { expect, test } from "vitest"
|
import { createDeferred } from "./deferred"
|
||||||
import { createDeferred } from "./deferred.js"
|
|
||||||
|
|
||||||
test("resolve", async () => {
|
test("resolve", async () => {
|
||||||
const deferred = createDeferred<string>()
|
const deferred = createDeferred<string>()
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/* eslint-disable unicorn/no-null */
|
/* eslint-disable unicorn/no-null */
|
||||||
import type { Message } from "discord.js"
|
import type { Message } from "discord.js"
|
||||||
import { Client, TextChannel } from "discord.js"
|
import { Client, TextChannel } from "discord.js"
|
||||||
import { deepEqual } from "node:assert"
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { afterAll, beforeAll, test } from "vitest"
|
|
||||||
import { pick } from "./helpers/pick.js"
|
import { pick } from "./helpers/pick.js"
|
||||||
import { raise } from "./helpers/raise.js"
|
import { raise } from "./helpers/raise.js"
|
||||||
import type { ReacordRoot } from "./main"
|
import type { ReacordRoot } from "./main"
|
||||||
@@ -150,8 +148,7 @@ function extractMessageData(message: Message) {
|
|||||||
async function assertMessages(expected: Array<DeepPartial<MessageData>>) {
|
async function assertMessages(expected: Array<DeepPartial<MessageData>>) {
|
||||||
const messages = await channel.messages.fetch()
|
const messages = await channel.messages.fetch()
|
||||||
|
|
||||||
deepEqual(
|
expect(messages.map((message) => extractMessageData(message))).toEqual(
|
||||||
messages.map((message) => extractMessageData(message)),
|
|
||||||
expected.map((message) => ({
|
expected.map((message) => ({
|
||||||
content: "",
|
content: "",
|
||||||
...message,
|
...message,
|
||||||
|
|||||||
Reference in New Issue
Block a user