Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,19 @@
"react-i18next": "^15.6.0",
"react-icons": "^5.5.0",
"react-joyride": "^2.9.3",
"react-router-dom": "^7.6.3",
"react-router-dom": "^7.13.0",
"string-similarity-js": "^2.1.4",
"uuid": "^11.1.0",
"webdav": "^5.8.0",
"webdav": "^5.9.0",
"yaml": "^2.8.1"
},
"devDependencies": {
"@crowdin/cli": "^4.9.0",
"@eslint/compat": "^1.4.1",
"@eslint/js": "9.38.0",
"@rspack/cli": "^1.5.8",
"@rspack/core": "^1.5.8",
"@eslint/js": "9.39.2",
"@rspack/cli": "^1.7.6",
"@rspack/core": "^1.6.8",
"@swc/helpers": "^0.5.17",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@types/chrome": "^0.1.27",
"@types/crypto-js": "^4.2.2",
Expand All @@ -68,11 +67,11 @@
"@types/semver": "^7.7.1",
"@types/serviceworker": "^0.0.120",
"@unocss/postcss": "66.5.4",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/coverage-v8": "^4.0.18",
"autoprefixer": "^10.4.21",
"cross-env": "^10.1.0",
"crx": "^5.0.1",
"eslint": "^9.38.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-react": "^7.37.5",
Expand All @@ -91,7 +90,7 @@
"typescript": "^5.9.3",
"typescript-eslint": "^8.46.2",
"unocss": "66.5.4",
"vitest": "^3.2.4"
"vitest": "^4.0.18"
},
"packageManager": "pnpm@10.12.4",
"sideEffects": [
Expand Down
6 changes: 3 additions & 3 deletions packages/message/message_queue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("MessageQueueGroup", () => {
});

describe("发布方法测试", () => {
it.concurrent("publish 方法应该使用 chrome.runtime.sendMessage", () => {
it("publish 方法应该使用 chrome.runtime.sendMessage", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concurrent 确实容易出问题,后面的单元测试我觉得也不用强求使用concurrent了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得是unit test 写得不好吧
不应该每一次test 改共通
而是一次过对共通做mock

不要用 .not.toHaveBeenCalled();
not.toHaveBeenCalledWith({ ... });


如果是简单的 test 的话,就用 concurrent 吧
通讯系的又懒写就不加 concurrent

现在升级到 4.x.x 应该速度会有提升

都随心吧。只是一个 test

const group = messageQueue.group("api-sendChromeMessage");

const sendSpy = vi.spyOn(chrome.runtime, "sendMessage");
Expand All @@ -209,11 +209,11 @@ describe("MessageQueueGroup", () => {
});
});

it.concurrent("emit 方法应该只在本地发布", () => {
it("emit 方法应该只在本地发布", () => {
const group = messageQueue.group("api-emitLocal");
const handler = vi.fn();

const sendSpy = vi.spyOn(chrome.runtime, "sendMessage");
const sendSpy = vi.spyOn(chrome.runtime, "sendMessage"); // 不能 concurrent
group.subscribe("test-emitLocal", handler);
group.emit("test-emitLocal", { data: "test-emitLocal" });

Expand Down
6 changes: 3 additions & 3 deletions packages/message/message_queue_group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("MessageQueueGroup", () => {
});

describe("发布方法测试", () => {
it.concurrent("publish 方法应该使用 chrome.runtime.sendMessage", () => {
it("publish 方法应该使用 chrome.runtime.sendMessage", () => {
const group = messageQueue.group("api-sendChromeMessage");

const sendSpy = vi.spyOn(chrome.runtime, "sendMessage");
Expand All @@ -210,10 +210,10 @@ describe("MessageQueueGroup", () => {
});
});

it.concurrent("emit 方法应该只在本地发布", () => {
it("emit 方法应该只在本地发布", () => {
const group = messageQueue.group("api-emitLocal");
const handler = vi.fn();
const sendSpy = vi.spyOn(chrome.runtime, "sendMessage");
const sendSpy = vi.spyOn(chrome.runtime, "sendMessage"); // 不能 concurrent
group.subscribe("test-emitLocal", handler);
group.emit("test-emitLocal", { data: "test-emitLocal" });
expect(handler).toHaveBeenCalledWith({ data: "test-emitLocal" });
Expand Down
Loading
Loading