try vitest again

This commit is contained in:
MapleLeaf
2021-12-22 21:36:57 -06:00
parent d85a27d6e1
commit 8978383db1
5 changed files with 207 additions and 1292 deletions

View File

@@ -3,6 +3,7 @@ import type { ButtonInteraction, Message, MessageOptions } from "discord.js"
import { Client, TextChannel } from "discord.js" import { Client, TextChannel } from "discord.js"
import { nanoid } from "nanoid" import { nanoid } from "nanoid"
import React, { useState } from "react" import React, { useState } from "react"
import { afterAll, beforeAll, expect, test } from "vitest"
import { omit } from "../src/helpers/omit.js" import { omit } from "../src/helpers/omit.js"
import { raise } from "../src/helpers/raise.js" import { raise } from "../src/helpers/raise.js"
import { waitForWithTimeout } from "../src/helpers/wait-for-with-timeout.js" import { waitForWithTimeout } from "../src/helpers/wait-for-with-timeout.js"

View File

@@ -1,20 +0,0 @@
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
transform: {
"^.+\\.tsx?$": [
"esbuild-jest",
{
format: "esm",
sourcemap: true,
},
],
},
moduleNameMapper: {
"(^(\\./|\\.\\./).+)\\.js$": "$1",
},
extensionsToTreatAsEsm: [".ts", ".tsx"],
verbose: true,
}
// eslint-disable-next-line import/no-unused-modules
export default config

View File

@@ -17,9 +17,9 @@
"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": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js --colors", "test": "vitest",
"test-watch": "node --experimental-vm-modules --no-warnings --inspect node_modules/jest/bin/jest.js --watch --colors --runInBand", "test-watch": "vitest --watch",
"coverage": "pnpm test -- --coverage", "coverage": "vitest --coverage",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"playground": "nodemon -x esmo ./playground/main.tsx" "playground": "nodemon -x esmo ./playground/main.tsx"
}, },
@@ -37,9 +37,9 @@
}, },
"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",
"discord.js": "^13.3.1", "discord.js": "^13.3.1",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"esbuild": "^0.14.6", "esbuild": "^0.14.6",
@@ -53,12 +53,13 @@
"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",
"esmo": "^0.13.0", "esmo": "^0.13.0",
"jest": "^27.4.5",
"nodemon": "^2.0.15", "nodemon": "^2.0.15",
"prettier": "^2.5.1", "prettier": "^2.5.1",
"react": "^17.0.2", "react": "^17.0.2",
"tsup": "^5.11.6", "tsup": "^5.11.6",
"typescript": "^4.5.4" "typescript": "^4.5.4",
"vite": "^2.7.6",
"vitest": "^0.0.108"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [

1450
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,10 @@
// would normally use .js extensions here,
// but that breaks in vitest
// https://github.com/vitest-dev/vitest/issues/282
/* eslint-disable import/no-unused-modules */ /* eslint-disable import/no-unused-modules */
export * from "./components/action-row.js" export * from "./components/action-row"
export * from "./components/button.js" export * from "./components/button"
export * from "./components/embed-field.js" export * from "./components/embed"
export * from "./components/embed.js" export * from "./components/embed-field"
export * from "./components/text.js" export * from "./components/text"
export * from "./root.js" export * from "./root"