tomolld
PD🧩 Plasmo Developers
•Created by tomolld on 3/26/2024 in #🔰newbie
How to do unit testing?
I attempted to download and test the
sample
jest, but it did not work due to the following error.
and i want to use vitest,or bun:test.please support!
jest
PASS tests/contents/index.test.ts
FAIL tests/contents/hello.test.tsx
● Test suite failed to run
tests/contents/hello.test.tsx:1:10 - error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
1 import { describe, expect, it } from "@jest/globals"
~~~~~~~~
tests/contents/hello.test.tsx:1:20 - error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
1 import { describe, expect, it } from "@jest/globals"
~~~~~~
tests/contents/hello.test.tsx:1:28 - error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
1 import { describe, expect, it } from "@jest/globals"
~~
tests/contents/hello.test.tsx:2:10 - error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
2 import { render } from "@testing-library/react"
~~~~~~
tests/contents/hello.test.tsx:4:8 - error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.
4 import HelloContent from "~contents/hello"
~~~~~~~~~~~~
Test Suites: 1 failed, 1 passed, 2 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 2.049 s
Ran all test suites.
ELIFECYCLE Test failed. See above for more details.
2 replies