相关疑难解决方法(0)

Swiper 8 和笑话

Swiper 8 和 Jest (支持 ESM) 必须使用 import 加载 ES 模块 在此处输入图像描述 在 此处输入图像描述

如果我需要保留 swiper 8(不降级),我们该如何解决

typescript reactjs jestjs es6-modules swiper.js

4
推荐指数
1
解决办法
4749
查看次数

在 firebase/auth 中使用 createUserWithEmailAndPassword 时,Jest 在 Next.js 和 TypeScript 中遇到意外令牌

我正在尝试在我的 Next.js 项目上设置 firebase 身份验证(使用 TypeScript),并且我相信我遇到了一些与使用 firebase 相关的配置问题,这些问题导致我的 Jest 测试失败。

以下是相关的配置文件:

笑话.config.js:

const nextJest = require("next/jest");

const createJestConfig = nextJest({
  // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
  dir: "./",
});

// Add any custom config to be passed to Jest
const customJestConfig = {
  setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
  moduleNameMapper: {
    // Handle module aliases (this will be automatically configured for you soon)
    "^@/components/(.*)$": "<rootDir>/components/$1",
    "^@/pages/(.*)$": "<rootDir>/pages/$1",
  },
  testEnvironment: "jest-environment-jsdom",
}; …
Run Code Online (Sandbox Code Playgroud)

firebase typescript jestjs firebase-authentication next.js

4
推荐指数
1
解决办法
2854
查看次数