From bb6e1f2719919df6aa1ae0be7c2a8518ddd21c06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:26:25 +0100 Subject: [PATCH 01/23] build(deps-dev): bump @swc/core from 1.15.7 to 1.15.8 (#4667) Bumps [@swc/core](https://github.com/swc-project/swc) from 1.15.7 to 1.15.8. - [Release notes](https://github.com/swc-project/swc/releases) - [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md) - [Commits](https://github.com/swc-project/swc/compare/v1.15.7...v1.15.8) --- updated-dependencies: - dependency-name: "@swc/core" dependency-version: 1.15.8 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/bot/package.json | 2 +- packages/discordeno/package.json | 2 +- packages/gateway/package.json | 2 +- packages/rest/package.json | 2 +- packages/types/package.json | 2 +- packages/utils/package.json | 2 +- yarn.lock | 100 +++++++++++++++---------------- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/packages/bot/package.json b/packages/bot/package.json index cb31ff7fb..76e1b6018 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -35,7 +35,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", "@types/mocha": "^10.0.10", "@types/node": "^25.0.3", diff --git a/packages/discordeno/package.json b/packages/discordeno/package.json index 11e99b859..20986a66a 100644 --- a/packages/discordeno/package.json +++ b/packages/discordeno/package.json @@ -35,7 +35,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", "@types/mocha": "^10.0.10", "@types/node": "^25.0.3", diff --git a/packages/gateway/package.json b/packages/gateway/package.json index 126404a9c..32ce00aa2 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -37,7 +37,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", "@types/mocha": "^10.0.10", "@types/node": "^25.0.3", diff --git a/packages/rest/package.json b/packages/rest/package.json index 621a89cf2..ded440b99 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", "@types/chai-as-promised": "^8.0.2", "@types/mocha": "^10.0.10", diff --git a/packages/types/package.json b/packages/types/package.json index 19896701e..d18de4c03 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -27,7 +27,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/mocha": "^10.0.10", "@types/node": "^25.0.3", "c8": "^10.1.3", diff --git a/packages/utils/package.json b/packages/utils/package.json index 1f797b854..9ccbad35a 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -31,7 +31,7 @@ "devDependencies": { "@biomejs/biome": "2.3.10", "@swc/cli": "^0.7.9", - "@swc/core": "^1.15.7", + "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", "@types/mocha": "^10.0.10", "@types/node": "^25.0.3", diff --git a/yarn.lock b/yarn.lock index 71f85ad9a..2ccd89283 100644 --- a/yarn.lock +++ b/yarn.lock @@ -122,7 +122,7 @@ __metadata: "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/chai": "npm:^5.2.3" "@types/mocha": "npm:^10.0.10" "@types/node": "npm:^25.0.3" @@ -145,7 +145,7 @@ __metadata: "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/chai": "npm:^5.2.3" "@types/mocha": "npm:^10.0.10" "@types/node": "npm:^25.0.3" @@ -174,7 +174,7 @@ __metadata: "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/chai": "npm:^5.2.3" "@types/chai-as-promised": "npm:^8.0.2" "@types/mocha": "npm:^10.0.10" @@ -198,7 +198,7 @@ __metadata: dependencies: "@biomejs/biome": "npm:2.3.10" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/mocha": "npm:^10.0.10" "@types/node": "npm:^25.0.3" c8: "npm:^10.1.3" @@ -216,7 +216,7 @@ __metadata: "@biomejs/biome": "npm:2.3.10" "@discordeno/types": "workspace:^" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/chai": "npm:^5.2.3" "@types/mocha": "npm:^10.0.10" "@types/node": "npm:^25.0.3" @@ -589,90 +589,90 @@ __metadata: languageName: node linkType: hard -"@swc/core-darwin-arm64@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-darwin-arm64@npm:1.15.7" +"@swc/core-darwin-arm64@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-darwin-arm64@npm:1.15.8" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@swc/core-darwin-x64@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-darwin-x64@npm:1.15.7" +"@swc/core-darwin-x64@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-darwin-x64@npm:1.15.8" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@swc/core-linux-arm-gnueabihf@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-linux-arm-gnueabihf@npm:1.15.7" +"@swc/core-linux-arm-gnueabihf@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.15.8" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@swc/core-linux-arm64-gnu@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-linux-arm64-gnu@npm:1.15.7" +"@swc/core-linux-arm64-gnu@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-linux-arm64-gnu@npm:1.15.8" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-arm64-musl@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-linux-arm64-musl@npm:1.15.7" +"@swc/core-linux-arm64-musl@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-linux-arm64-musl@npm:1.15.8" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@swc/core-linux-x64-gnu@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-linux-x64-gnu@npm:1.15.7" +"@swc/core-linux-x64-gnu@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-linux-x64-gnu@npm:1.15.8" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@swc/core-linux-x64-musl@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-linux-x64-musl@npm:1.15.7" +"@swc/core-linux-x64-musl@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-linux-x64-musl@npm:1.15.8" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@swc/core-win32-arm64-msvc@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-win32-arm64-msvc@npm:1.15.7" +"@swc/core-win32-arm64-msvc@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-win32-arm64-msvc@npm:1.15.8" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@swc/core-win32-ia32-msvc@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-win32-ia32-msvc@npm:1.15.7" +"@swc/core-win32-ia32-msvc@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-win32-ia32-msvc@npm:1.15.8" conditions: os=win32 & cpu=ia32 languageName: node linkType: hard -"@swc/core-win32-x64-msvc@npm:1.15.7": - version: 1.15.7 - resolution: "@swc/core-win32-x64-msvc@npm:1.15.7" +"@swc/core-win32-x64-msvc@npm:1.15.8": + version: 1.15.8 + resolution: "@swc/core-win32-x64-msvc@npm:1.15.8" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@swc/core@npm:^1.15.7": - version: 1.15.7 - resolution: "@swc/core@npm:1.15.7" +"@swc/core@npm:^1.15.8": + version: 1.15.8 + resolution: "@swc/core@npm:1.15.8" dependencies: - "@swc/core-darwin-arm64": "npm:1.15.7" - "@swc/core-darwin-x64": "npm:1.15.7" - "@swc/core-linux-arm-gnueabihf": "npm:1.15.7" - "@swc/core-linux-arm64-gnu": "npm:1.15.7" - "@swc/core-linux-arm64-musl": "npm:1.15.7" - "@swc/core-linux-x64-gnu": "npm:1.15.7" - "@swc/core-linux-x64-musl": "npm:1.15.7" - "@swc/core-win32-arm64-msvc": "npm:1.15.7" - "@swc/core-win32-ia32-msvc": "npm:1.15.7" - "@swc/core-win32-x64-msvc": "npm:1.15.7" + "@swc/core-darwin-arm64": "npm:1.15.8" + "@swc/core-darwin-x64": "npm:1.15.8" + "@swc/core-linux-arm-gnueabihf": "npm:1.15.8" + "@swc/core-linux-arm64-gnu": "npm:1.15.8" + "@swc/core-linux-arm64-musl": "npm:1.15.8" + "@swc/core-linux-x64-gnu": "npm:1.15.8" + "@swc/core-linux-x64-musl": "npm:1.15.8" + "@swc/core-win32-arm64-msvc": "npm:1.15.8" + "@swc/core-win32-ia32-msvc": "npm:1.15.8" + "@swc/core-win32-x64-msvc": "npm:1.15.8" "@swc/counter": "npm:^0.1.3" "@swc/types": "npm:^0.1.25" peerDependencies: @@ -701,7 +701,7 @@ __metadata: peerDependenciesMeta: "@swc/helpers": optional: true - checksum: 10c0/ae1d20db777bfe0404f2c840d8fa66da0664bca1f88ac8727cbe4c0cb04ee28505009b55caf345f1e790b96410f9bcf66d0178372e9c6505a9da76e7562a06bf + checksum: 10c0/929f334a224776fdb3c4a8aaba68f07666ff56fae7502a9459bc9666cb73d94e65f042ce8c4ef4e6746a8bb3f8255cbe8599bef6e3181269caf761c8e55513cf languageName: node linkType: hard @@ -1463,7 +1463,7 @@ __metadata: "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" - "@swc/core": "npm:^1.15.7" + "@swc/core": "npm:^1.15.8" "@types/chai": "npm:^5.2.3" "@types/mocha": "npm:^10.0.10" "@types/node": "npm:^25.0.3" From 4d5acdbe66f61d01d07252138c364ceebfa7a223 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:37:08 +0100 Subject: [PATCH 02/23] build(deps-dev): bump @biomejs/biome from 2.3.10 to 2.3.11 (#4668) * build(deps-dev): bump @biomejs/biome from 2.3.10 to 2.3.11 Bumps [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) from 2.3.10 to 2.3.11. - [Release notes](https://github.com/biomejs/biome/releases) - [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md) - [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.3.11/packages/@biomejs/biome) --- updated-dependencies: - dependency-name: "@biomejs/biome" dependency-version: 2.3.11 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update biome scheme version * update biome in /website --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Fleny --- biome.jsonc | 2 +- package.json | 2 +- packages/bot/package.json | 2 +- packages/discordeno/package.json | 2 +- packages/gateway/package.json | 2 +- packages/rest/package.json | 2 +- packages/types/package.json | 2 +- packages/utils/package.json | 2 +- website/package.json | 2 +- website/yarn.lock | 74 +++++++++++++-------------- yarn.lock | 86 ++++++++++++++++---------------- 11 files changed, 89 insertions(+), 89 deletions(-) diff --git a/biome.jsonc b/biome.jsonc index b05d02e21..9798b6e42 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.3.10/schema.json", + "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json", "root": true, "formatter": { "enabled": true, diff --git a/package.json b/package.json index 0c4d19461..52a96fe73 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "postinstall": "husky" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "husky": "^9.1.7", "lint-staged": "^16.2.7", "turbo": "^2.7.2", diff --git a/packages/bot/package.json b/packages/bot/package.json index 76e1b6018..b02b0524f 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -33,7 +33,7 @@ "@discordeno/utils": "workspace:^" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", diff --git a/packages/discordeno/package.json b/packages/discordeno/package.json index 20986a66a..64ce5990a 100644 --- a/packages/discordeno/package.json +++ b/packages/discordeno/package.json @@ -33,7 +33,7 @@ "@discordeno/utils": "workspace:^" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", diff --git a/packages/gateway/package.json b/packages/gateway/package.json index 32ce00aa2..e5ea4ea9c 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -35,7 +35,7 @@ "fzstd": "^0.1.1" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", diff --git a/packages/rest/package.json b/packages/rest/package.json index ded440b99..5e7411b04 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -31,7 +31,7 @@ "@discordeno/utils": "workspace:^" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", diff --git a/packages/types/package.json b/packages/types/package.json index d18de4c03..c6e6fc971 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -25,7 +25,7 @@ "test:type": "tsc --noEmit" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/mocha": "^10.0.10", diff --git a/packages/utils/package.json b/packages/utils/package.json index 9ccbad35a..be7a815aa 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -29,7 +29,7 @@ "@discordeno/types": "workspace:^" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@swc/cli": "^0.7.9", "@swc/core": "^1.15.8", "@types/chai": "^5.2.3", diff --git a/website/package.json b/website/package.json index 898ded332..9cf09402f 100644 --- a/website/package.json +++ b/website/package.json @@ -30,7 +30,7 @@ "react-dom": "^19.2.3" }, "devDependencies": { - "@biomejs/biome": "2.3.10", + "@biomejs/biome": "2.3.11", "@docusaurus/module-type-aliases": "^3.9.2", "@docusaurus/tsconfig": "^3.9.2", "@docusaurus/types": "^3.9.2", diff --git a/website/yarn.lock b/website/yarn.lock index 6e23dc075..5d49801d2 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -5361,18 +5361,18 @@ __metadata: languageName: node linkType: hard -"@biomejs/biome@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/biome@npm:2.3.10" +"@biomejs/biome@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/biome@npm:2.3.11" dependencies: - "@biomejs/cli-darwin-arm64": "npm:2.3.10" - "@biomejs/cli-darwin-x64": "npm:2.3.10" - "@biomejs/cli-linux-arm64": "npm:2.3.10" - "@biomejs/cli-linux-arm64-musl": "npm:2.3.10" - "@biomejs/cli-linux-x64": "npm:2.3.10" - "@biomejs/cli-linux-x64-musl": "npm:2.3.10" - "@biomejs/cli-win32-arm64": "npm:2.3.10" - "@biomejs/cli-win32-x64": "npm:2.3.10" + "@biomejs/cli-darwin-arm64": "npm:2.3.11" + "@biomejs/cli-darwin-x64": "npm:2.3.11" + "@biomejs/cli-linux-arm64": "npm:2.3.11" + "@biomejs/cli-linux-arm64-musl": "npm:2.3.11" + "@biomejs/cli-linux-x64": "npm:2.3.11" + "@biomejs/cli-linux-x64-musl": "npm:2.3.11" + "@biomejs/cli-win32-arm64": "npm:2.3.11" + "@biomejs/cli-win32-x64": "npm:2.3.11" dependenciesMeta: "@biomejs/cli-darwin-arm64": optional: true @@ -5392,62 +5392,62 @@ __metadata: optional: true bin: biome: bin/biome - checksum: 10c0/317bf8f8051f4030dc52855159bbd058db5cf2c9d5e7b212271f3d91842e0fc5bbc05495e47943676481325d4081cd41cf25dfa18a437d2b6e27f72dacfd41b4 + checksum: 10c0/b9764070c3d1583466a8861d37dc480c18103f7bb52115db0f265a38e6343d69792c9beea094e0b3db0905cb365b9a82ad2a0f3f05b7f04873a8f9b444263140 languageName: node linkType: hard -"@biomejs/cli-darwin-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-darwin-arm64@npm:2.3.10" +"@biomejs/cli-darwin-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-darwin-arm64@npm:2.3.11" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-darwin-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-darwin-x64@npm:2.3.10" +"@biomejs/cli-darwin-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-darwin-x64@npm:2.3.11" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@biomejs/cli-linux-arm64-musl@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.10" +"@biomejs/cli-linux-arm64-musl@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.11" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-arm64@npm:2.3.10" +"@biomejs/cli-linux-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-arm64@npm:2.3.11" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-linux-x64-musl@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.10" +"@biomejs/cli-linux-x64-musl@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.11" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-x64@npm:2.3.10" +"@biomejs/cli-linux-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-x64@npm:2.3.11" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-win32-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-win32-arm64@npm:2.3.10" +"@biomejs/cli-win32-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-win32-arm64@npm:2.3.11" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-win32-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-win32-x64@npm:2.3.10" +"@biomejs/cli-win32-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-win32-x64@npm:2.3.11" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -20786,7 +20786,7 @@ __metadata: version: 0.0.0-use.local resolution: "website@workspace:." dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@docusaurus/core": "npm:^3.9.2" "@docusaurus/faster": "npm:^3.9.2" "@docusaurus/module-type-aliases": "npm:^3.9.2" diff --git a/yarn.lock b/yarn.lock index 2ccd89283..7f846d1da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,18 +12,18 @@ __metadata: languageName: node linkType: hard -"@biomejs/biome@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/biome@npm:2.3.10" +"@biomejs/biome@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/biome@npm:2.3.11" dependencies: - "@biomejs/cli-darwin-arm64": "npm:2.3.10" - "@biomejs/cli-darwin-x64": "npm:2.3.10" - "@biomejs/cli-linux-arm64": "npm:2.3.10" - "@biomejs/cli-linux-arm64-musl": "npm:2.3.10" - "@biomejs/cli-linux-x64": "npm:2.3.10" - "@biomejs/cli-linux-x64-musl": "npm:2.3.10" - "@biomejs/cli-win32-arm64": "npm:2.3.10" - "@biomejs/cli-win32-x64": "npm:2.3.10" + "@biomejs/cli-darwin-arm64": "npm:2.3.11" + "@biomejs/cli-darwin-x64": "npm:2.3.11" + "@biomejs/cli-linux-arm64": "npm:2.3.11" + "@biomejs/cli-linux-arm64-musl": "npm:2.3.11" + "@biomejs/cli-linux-x64": "npm:2.3.11" + "@biomejs/cli-linux-x64-musl": "npm:2.3.11" + "@biomejs/cli-win32-arm64": "npm:2.3.11" + "@biomejs/cli-win32-x64": "npm:2.3.11" dependenciesMeta: "@biomejs/cli-darwin-arm64": optional: true @@ -43,62 +43,62 @@ __metadata: optional: true bin: biome: bin/biome - checksum: 10c0/317bf8f8051f4030dc52855159bbd058db5cf2c9d5e7b212271f3d91842e0fc5bbc05495e47943676481325d4081cd41cf25dfa18a437d2b6e27f72dacfd41b4 + checksum: 10c0/b9764070c3d1583466a8861d37dc480c18103f7bb52115db0f265a38e6343d69792c9beea094e0b3db0905cb365b9a82ad2a0f3f05b7f04873a8f9b444263140 languageName: node linkType: hard -"@biomejs/cli-darwin-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-darwin-arm64@npm:2.3.10" +"@biomejs/cli-darwin-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-darwin-arm64@npm:2.3.11" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-darwin-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-darwin-x64@npm:2.3.10" +"@biomejs/cli-darwin-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-darwin-x64@npm:2.3.11" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@biomejs/cli-linux-arm64-musl@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.10" +"@biomejs/cli-linux-arm64-musl@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-arm64-musl@npm:2.3.11" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-arm64@npm:2.3.10" +"@biomejs/cli-linux-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-arm64@npm:2.3.11" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-linux-x64-musl@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.10" +"@biomejs/cli-linux-x64-musl@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-x64-musl@npm:2.3.11" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@biomejs/cli-linux-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-linux-x64@npm:2.3.10" +"@biomejs/cli-linux-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-linux-x64@npm:2.3.11" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@biomejs/cli-win32-arm64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-win32-arm64@npm:2.3.10" +"@biomejs/cli-win32-arm64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-win32-arm64@npm:2.3.11" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@biomejs/cli-win32-x64@npm:2.3.10": - version: 2.3.10 - resolution: "@biomejs/cli-win32-x64@npm:2.3.10" +"@biomejs/cli-win32-x64@npm:2.3.11": + version: 2.3.11 + resolution: "@biomejs/cli-win32-x64@npm:2.3.11" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -116,7 +116,7 @@ __metadata: version: 0.0.0-use.local resolution: "@discordeno/bot@workspace:packages/bot" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@discordeno/gateway": "workspace:^" "@discordeno/rest": "workspace:^" "@discordeno/types": "workspace:^" @@ -141,7 +141,7 @@ __metadata: version: 0.0.0-use.local resolution: "@discordeno/gateway@workspace:packages/gateway" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" @@ -170,7 +170,7 @@ __metadata: version: 0.0.0-use.local resolution: "@discordeno/rest@workspace:packages/rest" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@discordeno/types": "workspace:^" "@discordeno/utils": "workspace:^" "@swc/cli": "npm:^0.7.9" @@ -196,7 +196,7 @@ __metadata: version: 0.0.0-use.local resolution: "@discordeno/types@workspace:packages/types" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@swc/cli": "npm:^0.7.9" "@swc/core": "npm:^1.15.8" "@types/mocha": "npm:^10.0.10" @@ -213,7 +213,7 @@ __metadata: version: 0.0.0-use.local resolution: "@discordeno/utils@workspace:packages/utils" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@discordeno/types": "workspace:^" "@swc/cli": "npm:^0.7.9" "@swc/core": "npm:^1.15.8" @@ -1442,7 +1442,7 @@ __metadata: version: 0.0.0-use.local resolution: "discordeno-monorepo@workspace:." dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" husky: "npm:^9.1.7" lint-staged: "npm:^16.2.7" turbo: "npm:^2.7.2" @@ -1456,7 +1456,7 @@ __metadata: version: 0.0.0-use.local resolution: "discordeno@workspace:packages/discordeno" dependencies: - "@biomejs/biome": "npm:2.3.10" + "@biomejs/biome": "npm:2.3.11" "@discordeno/bot": "workspace:^" "@discordeno/gateway": "workspace:^" "@discordeno/rest": "workspace:^" From 86c5601d5e07f1dafc37e190e1077b2a89ce9bb1 Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 7 Jan 2026 20:34:38 +0100 Subject: [PATCH 03/23] Use a single afterEach hook to clean up resources (#4665) Using `after` in the single tests is a bit messy as it runs after all the tests and if one fails sometime it won't run properly. This approach uses a single `afterEach` hook to clean up all resources created during the tests after each test run. Also remove `async` from describe functions as it is not supported and can lead to issues Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> --- packages/rest/tests/e2e/automod.spec.ts | 22 ++++------- packages/rest/tests/e2e/constants.ts | 6 +-- packages/rest/tests/e2e/emoji.spec.ts | 32 +++++++++------- packages/rest/tests/e2e/guild.spec.ts | 11 ++---- packages/rest/tests/e2e/message.spec.ts | 48 ++++++++++-------------- packages/rest/tests/e2e/misc.spec.ts | 8 ++-- packages/rest/tests/e2e/role.spec.ts | 28 +++----------- packages/rest/tests/e2e/stickers.spec.ts | 16 +++++--- packages/rest/tests/e2e/utils.ts | 23 +++++++++++- packages/rest/tests/e2e/webhook.spec.ts | 2 +- 10 files changed, 97 insertions(+), 99 deletions(-) diff --git a/packages/rest/tests/e2e/automod.spec.ts b/packages/rest/tests/e2e/automod.spec.ts index 4ed4168b2..340c2c8b0 100644 --- a/packages/rest/tests/e2e/automod.spec.ts +++ b/packages/rest/tests/e2e/automod.spec.ts @@ -1,8 +1,8 @@ import { AutoModerationActionType, AutoModerationEventTypes, AutoModerationTriggerTypes } from '@discordeno/types' import { expect } from 'chai' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' -describe('Automod tests', async () => { +describe('Automod tests', () => { it('Create a MessageSend rule for Keyword with BlockMessage action.', async () => { const rule = await rest.createAutomodRule(e2eCache.guild.id, { name: 'test', @@ -17,6 +17,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -30,8 +31,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions).to.be.exist expect(fetchedRule.actions[0]).to.be.exist expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.BlockMessage) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) it('Create a MessageSend rule for Keyword with Timeout action.', async () => { @@ -51,6 +50,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -65,8 +65,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions[0]).to.be.exist expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.Timeout) expect(fetchedRule.actions[0].metadata?.durationSeconds).to.equal(10) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) it('Create a MessageSend rule for Keyword with BlockMessage & Timeout action.', async () => { @@ -89,6 +87,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -103,8 +102,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.BlockMessage) expect(fetchedRule.actions[1].type).to.equal(AutoModerationActionType.Timeout) expect(fetchedRule.actions[1].metadata?.durationSeconds).to.equal(10) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) describe('with a channel', () => { @@ -125,6 +122,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -139,8 +137,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions[0]).to.be.exist expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.SendAlertMessage) expect(fetchedRule.actions[0].metadata?.channelId).to.equal(e2eCache.channel.id) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) it('Create a MessageSend rule for Keyword with SendAlertMessage & Timeout action.', async () => { @@ -166,6 +162,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -182,8 +179,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions[0].metadata?.channelId).to.equal(e2eCache.channel.id) expect(fetchedRule.actions[1].type).to.equal(AutoModerationActionType.Timeout) expect(fetchedRule.actions[1].metadata?.durationSeconds).to.equal(10) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) it('Create a MessageSend rule for Keyword with BlockMessage & SendAlertMessage & Timeout action.', async () => { @@ -212,6 +207,7 @@ describe('Automod tests', async () => { }, ], }) + toDispose.add(async () => await rest.deleteAutomodRule(e2eCache.guild.id, rule.id)) // Get the rule again to make sure it was created correctly const fetchedRule = await rest.getAutomodRule(e2eCache.guild.id, rule.id) @@ -232,8 +228,6 @@ describe('Automod tests', async () => { expect(fetchedRule.actions[0].type).to.equal(AutoModerationActionType.BlockMessage) expect(fetchedRule.actions[1].type).to.equal(AutoModerationActionType.SendAlertMessage) expect(fetchedRule.actions[2].type).to.equal(AutoModerationActionType.Timeout) - - await rest.deleteAutomodRule(e2eCache.guild.id, rule.id) }) }) }) diff --git a/packages/rest/tests/e2e/constants.ts b/packages/rest/tests/e2e/constants.ts index 910a65a2f..fb4a97e32 100644 --- a/packages/rest/tests/e2e/constants.ts +++ b/packages/rest/tests/e2e/constants.ts @@ -1,9 +1,9 @@ import dotenv from 'dotenv' -dotenv.config({ path: '../../.env' }) +dotenv.config({ path: '../../.env', quiet: true }) -if (!process.env.DISCORD_TOKEN) throw new Error('Token was not provided.') -export const token = process.env.DISCORD_TOKEN +export const token = process.env.DISCORD_TOKEN! +if (!token) throw new Error('Token was not provided.') export const E2E_TEST_GUILD_ID = process.env.E2E_TEST_GUILD_ID! if (!E2E_TEST_GUILD_ID) throw new Error('COMMUNITY guild id was not provided.') diff --git a/packages/rest/tests/e2e/emoji.spec.ts b/packages/rest/tests/e2e/emoji.spec.ts index 2810eb6e3..15ffb9822 100644 --- a/packages/rest/tests/e2e/emoji.spec.ts +++ b/packages/rest/tests/e2e/emoji.spec.ts @@ -3,7 +3,7 @@ import { urlToBase64 } from '@discordeno/utils' import { use as chaiUse, expect } from 'chai' import chaiAsPromised from 'chai-as-promised' import { describe, it } from 'mocha' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' chaiUse(chaiAsPromised) @@ -15,9 +15,10 @@ describe('Create and delete emojis', () => { roles: [], }) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)) + // Assertions - expect(emoji.id).to.be.exist - await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) + expect(emoji.id).to.exist }) // delete an emoji without a reason @@ -27,11 +28,15 @@ describe('Create and delete emojis', () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'), roles: [], }) + const cleanEmoji = async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) + toDispose.add(cleanEmoji) // Assertions - expect(emoji.id).to.be.exist + expect(emoji.id).to.exist await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) + // Remove from toDispose since we already deleted it + toDispose.delete(cleanEmoji) await expect(rest.getEmoji(e2eCache.guild.id, emoji.id!)).to.eventually.rejected }) @@ -43,11 +48,15 @@ describe('Create and delete emojis', () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'), roles: [], }) + const cleanEmoji = async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) + toDispose.add(cleanEmoji) // Assertions - expect(emoji.id).to.be.exist + expect(emoji.id).to.exist await rest.deleteEmoji(e2eCache.guild.id, emoji.id!, 'with a reason') + // Remove from toDispose since we already deleted it + toDispose.delete(cleanEmoji) await expect(rest.getEmoji(e2eCache.guild.id, emoji.id!)).to.eventually.rejected }) @@ -62,10 +71,8 @@ describe('Edit and get emojis', () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'), roles: [], })) as Camelize & { id: string } - }) - afterEach(async () => { - await rest.deleteEmoji(e2eCache.guild.id, emoji.id) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id)) }) // edit an emoji name @@ -83,9 +90,8 @@ describe('Edit and get emojis', () => { const role = await rest.createRole(e2eCache.guild.id, { name: 'dd-test-emoji', }) - after(async () => { - await rest.deleteRole(e2eCache.guild.id, role.id) - }) + toDispose.add(async () => await rest.deleteRole(e2eCache.guild.id, role.id)) + await rest.editEmoji(e2eCache.guild.id, emoji.id, { roles: [role.id], }) @@ -108,12 +114,12 @@ describe('Edit and get emojis', () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/814955268123000832.png'), roles: [], }) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, newEmoji.id!)) const exists = await rest.getEmojis(e2eCache.guild.id) + expect(exists.length).to.greaterThan(1) expect(exists.find((x) => x.id === newEmoji.id)).to.exist expect(exists.find((x) => x.id === emoji.id)).to.exist - - await rest.deleteEmoji(e2eCache.guild.id, newEmoji.id!) }) }) diff --git a/packages/rest/tests/e2e/guild.spec.ts b/packages/rest/tests/e2e/guild.spec.ts index 1bb3d2f0f..a82a34cfc 100644 --- a/packages/rest/tests/e2e/guild.spec.ts +++ b/packages/rest/tests/e2e/guild.spec.ts @@ -2,11 +2,11 @@ import { ChannelTypes } from '@discordeno/types' import { use as chaiUse, expect } from 'chai' import chaiAsPromised from 'chai-as-promised' import { describe, it } from 'mocha' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' chaiUse(chaiAsPromised) -describe('Manage Guilds', async () => { +describe('Manage Guilds', () => { it('Get a guild', async () => { const exists = await rest.getGuild(e2eCache.guildId) expect(exists).to.be.exist @@ -20,14 +20,10 @@ describe('Manage Guilds', async () => { name: 'e2e-afk-channel', type: ChannelTypes.GuildVoice, }) + toDispose.add(async () => await rest.deleteChannel(voiceChannel.id)) expect(voiceChannel.id).to.be.exist - after(async () => { - // Clean up the AFK channel created for testing - await rest.deleteChannel(voiceChannel.id) - }) - // Set the AFK channel const edited = await rest.editGuild(e2eCache.guild.id, { afkChannelId: voiceChannel.id, @@ -65,7 +61,6 @@ describe('Manage Guilds', async () => { expect(fetchedBan).to.be.exist expect(fetchedBan.user.id).to.equal('379643682984296448') - // Assertions expect(fetchedBans).to.be.exist expect(fetchedBans.length).to.greaterThanOrEqual(2) diff --git a/packages/rest/tests/e2e/message.spec.ts b/packages/rest/tests/e2e/message.spec.ts index 723438533..8f6b34915 100644 --- a/packages/rest/tests/e2e/message.spec.ts +++ b/packages/rest/tests/e2e/message.spec.ts @@ -1,14 +1,18 @@ import { processReactionString, urlToBase64 } from '@discordeno/utils' import { expect } from 'chai' import { describe, it } from 'mocha' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' describe('Send a message', () => { it('With content', async () => { const message = await rest.sendMessage(e2eCache.channel.id, { content: 'testing rate limit manager' }) + expect(message.content).to.be.equal('testing rate limit manager') + const edited = await rest.editMessage(message.channelId, message.id, { content: 'testing rate limit manager edited' }) + expect(message.content).to.be.not.equal(edited.content) + await rest.deleteMessage(message.channelId, message.id) }) @@ -16,40 +20,43 @@ describe('Send a message', () => { const image = await fetch('https://cdn.discordapp.com/avatars/270010330782892032/d031ea881688526d1ae235fd2843e53c.jpg?size=2048') .then(async (res) => await res.blob()) .catch(() => undefined) + expect(image).to.not.be.undefined - if (!image) throw new Error('Was not able to fetch the image.') - const message = await rest.sendMessage(e2eCache.channel.id, { files: [{ blob: image, name: 'gamer' }] }) - expect(message.attachments.length).to.be.greaterThan(0) + + const message = await rest.sendMessage(e2eCache.channel.id, { files: [{ blob: image!, name: 'gamer' }] }) const [attachment] = message.attachments + + expect(message.attachments.length).to.be.greaterThan(0) expect(attachment.filename).to.be.equal('gamer') }) it('With a file attachment', async () => { - const txtFile = new Blob(['hello world'], { type: 'text/plain' }) const fileMsg = await rest.sendMessage(e2eCache.channel.id, { content: '222', files: [ { name: 'application.txt', - blob: txtFile, + blob: new Blob(['hello world'], { type: 'text/plain' }), }, ], }) + expect(fileMsg.id).not.equals(undefined) expect(fileMsg.content).equals('222') expect(fileMsg.attachments.length).equals(1) expect(fileMsg.attachments.at(0)?.filename).equals('application.txt') expect(fileMsg.attachments.at(0)?.size).equals(11) - const txtFile2 = new Blob(['hello world edit'], { type: 'text/plain' }) + const edited = await rest.editMessage(e2eCache.channel.id, fileMsg.id, { content: '222 edit', files: [ { name: 'application_edit.txt', - blob: txtFile2, + blob: new Blob(['hello world edit'], { type: 'text/plain' }), }, ], }) + expect(edited.id).not.equals(undefined) expect(edited.content).equals('222 edit') expect(edited.attachments.length).equals(1) @@ -58,7 +65,7 @@ describe('Send a message', () => { }) }) -describe('Manage reactions', async () => { +describe('Manage reactions', () => { it('Add and delete a unicode reaction', async () => { const message = await rest.sendMessage(e2eCache.channel.id, { content: 'add reaction test' }) await rest.addReaction(message.channelId, message.id, '📙') @@ -79,11 +86,7 @@ describe('Manage reactions', async () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'), roles: [], }) - - after(async () => { - // Clean up the emoji created for testing - await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) - }) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)) const emojiCode = `<:${emoji.name!}:${emoji.id!}>` @@ -109,11 +112,7 @@ describe('Manage reactions', async () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'), roles: [], }) - - after(async () => { - // Clean up the emoji created for testing - await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) - }) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)) const emojiCode = `<:${emoji.name!}:${emoji.id!}>` @@ -136,11 +135,7 @@ describe('Manage reactions', async () => { image: await urlToBase64('https://cdn.discordapp.com/emojis/785403373817823272.webp?size=96'), roles: [], }) - - after(async () => { - // Clean up the emoji created for testing - await rest.deleteEmoji(e2eCache.guild.id, emoji.id!) - }) + toDispose.add(async () => await rest.deleteEmoji(e2eCache.guild.id, emoji.id!)) const emojiCode = `<:${emoji.name!}:${emoji.id!}>` @@ -197,10 +192,7 @@ describe('Rate limit manager testing', () => { // Create 10 channels and send a message to each const promises = Array.from({ length: 10 }, async (_, i) => { const channel = await rest.createChannel(e2eCache.guild.id, { name: `rate-limit-${i}` }) - - after(async () => { - await rest.deleteChannel(channel.id) - }) + toDispose.add(async () => await rest.deleteChannel(channel.id)) const messagePromises = Array.from({ length: 10 }, async (_, j) => { await rest.sendMessage(channel.id, { content: `testing rate limit manager ${j}` }) diff --git a/packages/rest/tests/e2e/misc.spec.ts b/packages/rest/tests/e2e/misc.spec.ts index 8505c207f..d0f3e8f92 100644 --- a/packages/rest/tests/e2e/misc.spec.ts +++ b/packages/rest/tests/e2e/misc.spec.ts @@ -1,13 +1,16 @@ +import { use as chaiUse, expect } from 'chai' +import chaiAsPromised from 'chai-as-promised' import { describe } from 'mocha' import { e2eCache, rest } from './utils.js' +chaiUse(chaiAsPromised) + describe('Typings', () => { it('Trigger Typing Indication', async () => { await rest.triggerTypingIndicator(e2eCache.channel.id) }) }) -/* TODO: Add this back when bot's name is changed (https://discord.com/channels/785384884197392384/785384884197392387/1142474846811459776) describe('Commands', () => { it('Upsert global commands', async () => { await rest.upsertGlobalApplicationCommands([ @@ -33,7 +36,6 @@ describe('Commands', () => { await rest.deleteGlobalApplicationCommand(created!.id) - expect(rest.getGlobalApplicationCommand(created!.id)).to.throw + await expect(rest.getGlobalApplicationCommand(created!.id)).to.eventually.be.rejected }) }) -*/ diff --git a/packages/rest/tests/e2e/role.spec.ts b/packages/rest/tests/e2e/role.spec.ts index 82de30b45..faa33d857 100644 --- a/packages/rest/tests/e2e/role.spec.ts +++ b/packages/rest/tests/e2e/role.spec.ts @@ -1,17 +1,13 @@ import { calculateBits } from '@discordeno/utils' import { expect } from 'chai' import { describe, it } from 'mocha' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' -describe('Role tests', async () => { +describe('Role tests', () => { // Create a role with a reason it('Create a role with a reason', async () => { const role = await rest.createRole(e2eCache.guild?.id, { name: `test role ${Date.now()}` }, 'test reason') - - after(async () => { - // Clean up the role created for testing - await rest.deleteRole(e2eCache.guild.id, role.id) - }) + toDispose.add(async () => await rest.deleteRole(e2eCache.guild.id, role.id)) expect(role.id).to.exist }) @@ -21,11 +17,7 @@ describe('Role tests', async () => { const role = await rest.createRole(e2eCache.guild.id, { name: `test role ${Date.now()}`, }) - - after(async () => { - // Clean up the role created for testing - await rest.deleteRole(e2eCache.guild.id, role.id) - }) + toDispose.add(async () => await rest.deleteRole(e2eCache.guild.id, role.id)) expect(role.id).to.exist }) @@ -47,11 +39,7 @@ describe('Role tests', async () => { const role = await rest.createRole(e2eCache.guild.id, { name: `test role ${Date.now()}`, }) - - after(async () => { - // Clean up the role created for testing - await rest.deleteRole(e2eCache.guild.id, role.id) - }) + toDispose.add(async () => await rest.deleteRole(e2eCache.guild.id, role.id)) const edited = await rest.editRole(e2eCache.guild.id, role.id, { name: 'test role 4', @@ -82,11 +70,7 @@ describe('Role tests', async () => { const role = await rest.createRole(e2eCache.guild.id, { name: `test role ${Date.now()}`, }) - - after(async () => { - // Clean up the role created for testing - await rest.deleteRole(e2eCache.guild.id, role.id) - }) + toDispose.add(async () => await rest.deleteRole(e2eCache.guild.id, role.id)) // Assign the role to the user await rest.addRole(e2eCache.guild.id, rest.applicationId, role.id) diff --git a/packages/rest/tests/e2e/stickers.spec.ts b/packages/rest/tests/e2e/stickers.spec.ts index a36566577..6eeb3b3be 100644 --- a/packages/rest/tests/e2e/stickers.spec.ts +++ b/packages/rest/tests/e2e/stickers.spec.ts @@ -2,12 +2,12 @@ import { StickerFormatTypes } from '@discordeno/types' import { use as chaiUse, expect } from 'chai' import chaiAsPromised from 'chai-as-promised' import { describe, it } from 'mocha' -import { e2eCache, rest } from './utils.js' +import { e2eCache, rest, toDispose } from './utils.js' chaiUse(chaiAsPromised) // waiting for channel -describe('Sticker tests', async () => { +describe('Sticker tests', () => { it('Can get a sticker', async () => { const sticker = await rest.getSticker(749054660769218631n) expect(sticker.name).to.equal('Wave') @@ -23,6 +23,10 @@ describe('Sticker tests', async () => { name: 'ddlogo.png', }, }) + const cleanSticker = async () => await rest.deleteGuildSticker(e2eCache.guild.id, sticker.id) + + // We may remove this as we also test sticker deletion at the end of the test, so we need a var to reference the function + toDispose.add(cleanSticker) expect(sticker.name).to.equal('sticker name') expect(sticker.description).to.equal('sticker description') @@ -62,15 +66,15 @@ describe('Sticker tests', async () => { }, }) - after(async () => { - // Clean up the sticker created for testing - await rest.deleteGuildSticker(e2eCache.guild.id, sticker2.id) - }) + toDispose.add(async () => await rest.deleteGuildSticker(e2eCache.guild.id, sticker2.id)) const stickers = await rest.getGuildStickers(e2eCache.guild.id) expect(stickers.length).to.greaterThan(1) await rest.deleteGuildSticker(e2eCache.guild.id, sticker.id) + // Since we have already deleted the sticker, we can remove it from the toDispose set + toDispose.delete(cleanSticker) + await expect(rest.getGuildSticker(e2eCache.guild.id, sticker.id)).to.eventually.rejected }) }) diff --git a/packages/rest/tests/e2e/utils.ts b/packages/rest/tests/e2e/utils.ts index 82ca8b25b..f6487baca 100644 --- a/packages/rest/tests/e2e/utils.ts +++ b/packages/rest/tests/e2e/utils.ts @@ -3,7 +3,6 @@ import { createRestManager } from '../../src/manager.js' import { E2E_TEST_GUILD_ID, token } from './constants.js' // For debugging purposes // logger.setLevel(LogLevels.Debug) -// logger.setDepth(LogDepth.Full) export const rest = createRestManager({ token, @@ -29,3 +28,25 @@ export const e2eCache = { guild, channel, } + +// Some resources created during tests need to be disposed of afterwards, as they will persist otherwise (e.g., emojis, roles, automod rules) +export const toDispose = new Set<() => Promise>() + +afterEach(async () => { + let aggregateError: AggregateError | null = null + + for (const dispose of toDispose) { + try { + await dispose() + } catch (error) { + console.error('Error during cleanup:', error) + + aggregateError ??= new AggregateError([], 'Errors occurred during cleanup') + aggregateError.errors.push(error) + } + } + + toDispose.clear() + + if (aggregateError) throw aggregateError +}) diff --git a/packages/rest/tests/e2e/webhook.spec.ts b/packages/rest/tests/e2e/webhook.spec.ts index 3175af6ec..654452275 100644 --- a/packages/rest/tests/e2e/webhook.spec.ts +++ b/packages/rest/tests/e2e/webhook.spec.ts @@ -5,7 +5,7 @@ import { e2eCache, rest } from './utils.js' chaiUse(chaiAsPromised) -describe('Webhook helpers', async () => { +describe('Webhook helpers', () => { it('Manage webhooks', async () => { const webhook = await rest.createWebhook(e2eCache.channel.id, { name: 'idk', From 011f0fe0dce5a79847ad6c2faf9fe604b78c066a Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 7 Jan 2026 20:40:27 +0100 Subject: [PATCH 04/23] ci: Use turbo remote cache (#4666) * Use a turbo remote cache server for CI `rharkor/caching-for-turbo` uses github actions cache to provide a remote cache server for turbo, so we can use previuously created cache if available and requested by turbo, and this doesn't have the downside of having the cache growing indefinitely like with normal github actions cache as since the single caches are uploaded to the github actions cache, github can evict the old cache when it's not used or there is no space left. Also add turbo to website so we can cache the build * Use turbo for website build & build:doc * fix typo, tubo -> turbo --------- Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> --- .github/workflows/e2e-test.yml | 16 ++--- .github/workflows/integration-test.yml | 16 ++--- .github/workflows/lib-check.yml | 49 +++++-------- .github/workflows/other-runtime-unit-test.yml | 32 +++------ .github/workflows/site.yml | 27 ++++--- .github/workflows/unit-test.yml | 22 ++---- turbo.json | 5 ++ website/package.json | 2 + website/turbo.json | 9 +++ website/yarn.lock | 72 +++++++++++++++++++ 10 files changed, 143 insertions(+), 107 deletions(-) create mode 100644 website/turbo.json diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index c810fdb13..4999ac274 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -22,21 +22,13 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-test:e2e-${{ inputs.package }}-${{ github.sha }} - - name: Build dist cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} + cache-prefix: turbo-cache- - name: E2E Test if: ${{ inputs.event_name != 'pull_request' }} - run: yarn test:e2e --cache-dir=".turbo" --filter=./packages/${{ inputs.package }} + run: yarn test:e2e --filter=./packages/${{ inputs.package }} timeout-minutes: 5 env: DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }} diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 316f52e9e..3f5357640 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -19,20 +19,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-test:integration-${{ inputs.package }}-${{ github.sha }} - - name: Build dist cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} + cache-prefix: turbo-cache- - name: Integration Test - run: yarn test:integration --cache-dir=".turbo" --filter=./packages/${{ inputs.package }} + run: yarn test:integration --filter=./packages/${{ inputs.package }} timeout-minutes: 3 - name: Collect and upload the coverage report uses: codecov/codecov-action@v5 diff --git a/.github/workflows/lib-check.yml b/.github/workflows/lib-check.yml index 2b07e8bd0..8f4aa44c1 100644 --- a/.github/workflows/lib-check.yml +++ b/.github/workflows/lib-check.yml @@ -6,8 +6,6 @@ on: push: branches: - main - paths-ignore: - - 'website/**' merge_group: jobs: @@ -21,14 +19,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} + cache-prefix: turbo-cache- - name: Build Types - run: yarn build:type --cache-dir=".turbo" + run: yarn build:type build-dist: name: Build Dist @@ -40,14 +36,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Type Test - run: yarn build --cache-dir=".turbo" + cache-prefix: turbo-cache- + - name: Build Dist + run: yarn build format: name: Format @@ -60,13 +54,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Build type cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} + cache-prefix: turbo-cache- - name: Build Types - run: yarn build:type --cache-dir=".turbo" + run: yarn build:type - name: Check Formatting run: yarn biome ci --reporter=github @@ -81,20 +74,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-unit-and-integration-test:test-type-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} + cache-prefix: turbo-cache- - name: Test Type Test - run: yarn test:test-type --cache-dir=".turbo" + run: yarn test:test-type # Not using matrix because test later on cant needs a specific job bot-unit-test: diff --git a/.github/workflows/other-runtime-unit-test.yml b/.github/workflows/other-runtime-unit-test.yml index 0b5061ab0..d6007d344 100644 --- a/.github/workflows/other-runtime-unit-test.yml +++ b/.github/workflows/other-runtime-unit-test.yml @@ -22,20 +22,12 @@ jobs: with: deno-version: 'v2.1.x' - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-test:deno-unit-${{ inputs.package }}-${{ github.sha }} - - name: Build dist cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} + cache-prefix: turbo-cache- - name: Deno Unit Test - run: yarn test:deno-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }} + run: yarn test:deno-unit --filter=./packages/${{ inputs.package }} bun-unit-test: name: Bun Unit Test runs-on: ubuntu-latest @@ -49,18 +41,10 @@ jobs: with: bun-version: '1.1.42' - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-test:bun-unit-${{ inputs.package }}-${{ github.sha }} - - name: Build dist cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} + cache-prefix: turbo-cache- - name: Bun Unit Test - run: yarn test:bun-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }} + run: yarn test:bun-unit --filter=./packages/${{ inputs.package }} timeout-minutes: 1 diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 79c07575a..43af9cd55 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -4,12 +4,6 @@ permissions: on: push: branches: ['main'] - paths: - - 'website/**' - - '.github/workflows/site.yml' - - 'typedoc.json' - - 'package.json' - - 'packages/**' pull_request: workflow_dispatch: @@ -31,10 +25,19 @@ jobs: website/yarn.lock - name: yarn install (root) run: yarn install --immutable + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 + with: + cache-prefix: turbo-cache- + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 + with: + cache-prefix: turbo-cache-website- + server-port: 41231 # The default is 41230, but we use a different cache key so we need a different port - name: Build all pkg run: yarn release-build - name: Build docs - run: yarn build:doc + run: yarn turbo build:doc --single-package - run: yarn install --immutable working-directory: ./website - name: Restore bundler cache @@ -45,8 +48,10 @@ jobs: restore-keys: | ${{ runner.os }}-docusaurus-bundler- - name: Build website - run: yarn build + run: yarn turbo build working-directory: ./website + env: + TURBO_API: http://localhost:41231 - name: Upload artifact uses: actions/upload-pages-artifact@v4 with: @@ -64,10 +69,14 @@ jobs: website/yarn.lock - name: yarn install (root) run: yarn install --immutable + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 + with: + cache-prefix: turbo-cache- - name: Build all pkg run: yarn release-build - name: Build docs - run: yarn build:doc + run: yarn turbo build:doc --single-package - run: yarn install --immutable working-directory: ./website - run: yarn typecheck diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 326708ea2..fd9945f3e 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -19,26 +19,12 @@ jobs: node-version: 20 cache: yarn - run: yarn install --immutable - - name: Turbo Cache - id: turbo-cache - uses: actions/cache@v5 + - name: Cache for Turbo + uses: rharkor/caching-for-turbo@v2.3.5 with: - path: .turbo - key: ${{ runner.os }}-turbo-test:unit-${{ inputs.package }}-${{ github.sha }} - - name: Build dist cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build-${{ github.sha }} - - name: Build type cache - if: steps.turbo-cache.outputs.cache-hit != 'true' - uses: actions/cache@v5 - with: - path: .turbo - key: ${{ runner.os }}-turbo-build:type-${{ github.sha }} + cache-prefix: turbo-cache- - name: Unit Test - run: yarn test:unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }} + run: yarn test:unit --filter=./packages/${{ inputs.package }} timeout-minutes: 1 - name: Collect and upload the coverage report uses: codecov/codecov-action@v5 diff --git a/turbo.json b/turbo.json index 48e5c9456..50d37da4f 100644 --- a/turbo.json +++ b/turbo.json @@ -38,6 +38,11 @@ "check": { "dependsOn": ["build:type"], "cache": false + }, + "build:doc": { + // NOTE: This task can only be run with "--singe-package" in the flags to turbo, as it is defined only in the root package.json + "inputs": ["packages/**/src/**/*.ts"], + "outputs": ["website/api_reference/generated/**/*"] } } } diff --git a/website/package.json b/website/package.json index 9cf09402f..1d1af521c 100644 --- a/website/package.json +++ b/website/package.json @@ -1,6 +1,7 @@ { "name": "website", "version": "0.0.0", + "packageManager": "yarn@4.12.0", "private": true, "scripts": { "docusaurus": "docusaurus", @@ -35,6 +36,7 @@ "@docusaurus/tsconfig": "^3.9.2", "@docusaurus/types": "^3.9.2", "@types/react": "^19.2.7", + "turbo": "^2.7.2", "typescript": "5.9.3", "webpack": "5.104.1" }, diff --git a/website/turbo.json b/website/turbo.json new file mode 100644 index 000000000..8130fde5d --- /dev/null +++ b/website/turbo.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://turbo.build/schema.json", + "tasks": { + "build": { + "outputs": ["build/**"], + "inputs": ["src/**/*", "static/**/*", "blog/**/*", "docs/**/*", "api_reference/**/*", "docusaurus.config.ts", "sidebars.ts"] + } + } +} diff --git a/website/yarn.lock b/website/yarn.lock index 5d49801d2..833cf40af 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -19935,6 +19935,77 @@ __metadata: languageName: node linkType: hard +"turbo-darwin-64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-darwin-64@npm:2.7.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"turbo-darwin-arm64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-darwin-arm64@npm:2.7.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"turbo-linux-64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-linux-64@npm:2.7.2" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"turbo-linux-arm64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-linux-arm64@npm:2.7.2" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"turbo-windows-64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-windows-64@npm:2.7.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"turbo-windows-arm64@npm:2.7.2": + version: 2.7.2 + resolution: "turbo-windows-arm64@npm:2.7.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"turbo@npm:^2.7.2": + version: 2.7.2 + resolution: "turbo@npm:2.7.2" + dependencies: + turbo-darwin-64: "npm:2.7.2" + turbo-darwin-arm64: "npm:2.7.2" + turbo-linux-64: "npm:2.7.2" + turbo-linux-arm64: "npm:2.7.2" + turbo-windows-64: "npm:2.7.2" + turbo-windows-arm64: "npm:2.7.2" + dependenciesMeta: + turbo-darwin-64: + optional: true + turbo-darwin-arm64: + optional: true + turbo-linux-64: + optional: true + turbo-linux-arm64: + optional: true + turbo-windows-64: + optional: true + turbo-windows-arm64: + optional: true + bin: + turbo: bin/turbo + checksum: 10c0/390937a32070ac52120af56705006e831de2edf8e22a2b0146006d07740cd413b3a36335339e7617b57cf74b008f4b15931cf56e1c7c0c03808f028ed937c4de + languageName: node + linkType: hard + "type-fest@npm:^0.21.3": version: 0.21.3 resolution: "type-fest@npm:0.21.3" @@ -20803,6 +20874,7 @@ __metadata: prism-react-renderer: "npm:^2.4.1" react: "npm:^19.2.3" react-dom: "npm:^19.2.3" + turbo: "npm:^2.7.2" typescript: "npm:5.9.3" webpack: "npm:5.104.1" languageName: unknown From 8d90f28307c0d900b728fba8c895e82cb38ac1bf Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 7 Jan 2026 20:51:26 +0100 Subject: [PATCH 05/23] test: Refactor mocha config & test scripts (#4664) * Merge mocha config file * Simplify scripts, remove coverage path fixing Codecov is able to fix the coverage paths on its own * Readd coveragePathFixing script * Fix coverage path fix script --- .mocharc.base.cjs | 9 ------- .mocharc.cjs | 27 ++++++++++++++++---- package.json | 7 +++--- packages/bot/package.json | 14 +++++------ packages/discordeno/package.json | 12 ++++----- packages/gateway/package.json | 14 +++++------ packages/rest/package.json | 14 +++++------ packages/types/package.json | 9 +++---- packages/utils/package.json | 12 ++++----- turbo.json | 42 +++++++++++++++++++++----------- 10 files changed, 85 insertions(+), 75 deletions(-) delete mode 100644 .mocharc.base.cjs diff --git a/.mocharc.base.cjs b/.mocharc.base.cjs deleted file mode 100644 index 4d585c8b0..000000000 --- a/.mocharc.base.cjs +++ /dev/null @@ -1,9 +0,0 @@ -// This needs to be a different file as this is used for Deno and Bun - -module.exports = { - recursive: true, - timeout: 2000, - 'watch-extensions': 'ts', - 'watch-files': ['src', 'tests'], - parallel: false, -} diff --git a/.mocharc.cjs b/.mocharc.cjs index cc65d8d85..ae8736faa 100644 --- a/.mocharc.cjs +++ b/.mocharc.cjs @@ -1,6 +1,23 @@ -module.exports = { - ...require('./.mocharc.base.cjs'), - require: 'ts-node/register', - loader: 'ts-node/esm', - 'enable-source-maps': true, +// @ts-check + +// If we are running in Bun or Deno, they have native TypeScript support with .js imports, node requires .ts imports +const supportsTypescript = 'Bun' in globalThis || 'Deno' in globalThis + +/** @type {import("mocha").MochaInstanceOptions & Record} */ +const mochaConfig = { + timeout: 2000, + 'watch-extensions': 'ts', + 'watch-files': ['src', 'tests'], } + +if (!supportsTypescript) { + mochaConfig.require = ['ts-node/register'] + + // Node options + mochaConfig.loader = ['ts-node/esm'] + // Node will output a ExperimentalWarning about --loader (--experimental-loader) and a DeprecationWarning because ts-node uses fs.Stat + mochaConfig['no-warnings'] = true + mochaConfig['enable-source-maps'] = true +} + +module.exports = mochaConfig diff --git a/package.json b/package.json index 52a96fe73..7156d505e 100644 --- a/package.json +++ b/package.json @@ -10,17 +10,16 @@ "scripts": { "build": "turbo build", "build:type": "turbo build:type", + "release-build": "turbo build build:type", "build:doc": "typedoc --options ./typedoc.jsonc", "build:watch": "turbo watch build build:type", - "release-build": "turbo build build:type", "test:unit": "turbo test:unit", - "test:unit-coverage": "turbo test:unit-coverage", - "test:bun-unit": "turbo test:bun-unit", "test:deno-unit": "turbo test:deno-unit", + "test:bun-unit": "turbo test:bun-unit", "test:integration": "turbo test:integration", "test:e2e": "turbo test:e2e", - "test:type": "turbo build:type", "test:test-type": "turbo test:test-type", + "test:type": "turbo build:type", "check": "turbo check", "check:all": "biome check --write", "postinstall": "husky" diff --git a/packages/bot/package.json b/packages/bot/package.json index b02b0524f..dc9399558 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -17,14 +17,12 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:e2e": "c8 --r lcov mocha --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", - "test:type": "tsc --noEmit", - "test:test-type": "tsc --project tests/tsconfig.json" + "test:unit": "c8 -r lcov mocha 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js bot", + "test:deno-unit": "deno -A npm:mocha 'tests/unit/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/unit/**/*.spec.ts'", + "test:e2e": "c8 -r lcov mocha -t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js bot", + "test:test-type": "tsc --project tests/tsconfig.json", + "test:type": "tsc --noEmit" }, "dependencies": { "@discordeno/gateway": "workspace:^", diff --git a/packages/discordeno/package.json b/packages/discordeno/package.json index 64ce5990a..4a57766db 100644 --- a/packages/discordeno/package.json +++ b/packages/discordeno/package.json @@ -17,13 +17,11 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", - "test:type": "tsc --noEmit", - "test:test-type": "tsc --project tests/tsconfig.json" + "test:unit": "c8 -r lcov mocha 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno", + "test:deno-unit": "deno -A npm:mocha 'tests/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/**/*.spec.ts'", + "test:test-type": "tsc --project tests/tsconfig.json", + "test:type": "tsc --noEmit" }, "dependencies": { "@discordeno/bot": "workspace:^", diff --git a/packages/gateway/package.json b/packages/gateway/package.json index e5ea4ea9c..a3c2979a8 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -17,14 +17,12 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:integration": "c8 --r lcov mocha --no-warnings --t 15000 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", - "test:type": "tsc --noEmit", - "test:test-type": "tsc --project tests/tsconfig.json" + "test:unit": "c8 -r lcov mocha 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", + "test:deno-unit": "deno -A npm:mocha 'tests/unit/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/unit/**/*.spec.ts'", + "test:integration": "c8 -r lcov mocha -t 15000 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway", + "test:test-type": "tsc --project tests/tsconfig.json", + "test:type": "tsc --noEmit" }, "dependencies": { "@discordeno/types": "workspace:^", diff --git a/packages/rest/package.json b/packages/rest/package.json index 5e7411b04..1dcf0523b 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -17,14 +17,12 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/unit/**/*.spec.ts'", - "test:e2e": "c8 --r lcov mocha --exit --no-warnings --jobs 1 --t 60000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", - "test:type": "tsc --noEmit", - "test:test-type": "tsc --project tests/tsconfig.json" + "test:unit": "c8 -r lcov mocha 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", + "test:deno-unit": "deno -A npm:mocha 'tests/unit/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/unit/**/*.spec.ts'", + "test:e2e": "c8 -r lcov mocha -t 60000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest", + "test:test-type": "tsc --project tests/tsconfig.json", + "test:type": "tsc --noEmit" }, "dependencies": { "@discordeno/types": "workspace:^", diff --git a/packages/types/package.json b/packages/types/package.json index c6e6fc971..b79c7ca40 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -17,11 +17,10 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", + "test:unit": "c8 -r lcov mocha 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js types", + "test:deno-unit": "deno -A npm:mocha 'tests/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/**/*.spec.ts'", + "test:test-type": "tsc --project tests/tsconfig.json", "test:type": "tsc --noEmit" }, "devDependencies": { diff --git a/packages/utils/package.json b/packages/utils/package.json index be7a815aa..a7feb9c23 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -17,13 +17,11 @@ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist", "release-build": "yarn build && yarn build:type", "check": "biome check --write", - "test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'", - "test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", - "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'", - "test:deno-unit": "deno -A ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", - "test:bun-unit": "bun ../../node_modules/mocha/bin/mocha.js --config ../../.mocharc.base.cjs 'tests/**/*.spec.ts'", - "test:type": "tsc --noEmit", - "test:test-type": "tsc --project tests/tsconfig.json" + "test:unit": "c8 -r lcov mocha 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils", + "test:deno-unit": "deno -A npm:mocha 'tests/**/*.spec.ts'", + "test:bun-unit": "bun --bun mocha 'tests/**/*.spec.ts'", + "test:test-type": "tsc --project tests/tsconfig.json", + "test:type": "tsc --noEmit" }, "dependencies": { "@discordeno/types": "workspace:^" diff --git a/turbo.json b/turbo.json index 50d37da4f..a9c2c53b9 100644 --- a/turbo.json +++ b/turbo.json @@ -2,39 +2,53 @@ "$schema": "https://turbo.build/schema.json", "tasks": { "build": { - "outputs": ["dist/**/*.js"], - "inputs": ["src/**/*.ts"] + "inputs": ["src/**/*.ts"], + "outputs": ["dist/**/*.js"] }, "build:type": { "dependsOn": ["^build:type"], + "inputs": ["src/**/*.ts"], "outputs": ["dist/**/*.d.ts", "dist/**/*.d.ts.map", "dist/tsconfig.tsbuildinfo"] }, - "test:unit-coverage": { - "dependsOn": ["^build"], - "outputs": ["coverage/**"] + "check": { + "dependsOn": ["build:type"], + "cache": false }, "test:unit": { "dependsOn": ["^build", "build"], + // We need to exclude e2e and integration test manually since when there aren't e2e or integration we don't have a unit folder + "inputs": ["src/**/*.ts", "tests/**/*.spec.ts", "!tests/e2e/**/*.spec.ts", "!tests/integration**/*.spec.ts"], "outputs": ["coverage/**"] }, + "test:deno-unit": { + "dependsOn": ["^build", "build"], + // We need to exclude e2e and integration test manually since when there aren't e2e or integration we don't have a unit folder + "inputs": ["src/**/*.ts", "tests/**/*.spec.ts", "!tests/e2e/**/*.spec.ts", "!tests/integration**/*.spec.ts"] + }, + "test:bun-unit": { + "dependsOn": ["^build", "build"], + // We need to exclude e2e and integration test manually since when there aren't e2e or integration we don't have a unit folder + "inputs": ["src/**/*.ts", "tests/**/*.spec.ts", "!tests/e2e/**/*.spec.ts", "!tests/integration**/*.spec.ts"] + }, "test:integration": { "dependsOn": ["^build"], + "inputs": ["src/**/*.ts", "tests/integration**/*.spec.ts"], "outputs": ["coverage/**"] }, - "test:test-type": { - "dependsOn": ["^build:type"] - }, - "test:deno-unit": { - "dependsOn": ["^build", "build"] - }, - "test:bun-unit": { - "dependsOn": ["^build", "build"] - }, "test:e2e": { "dependsOn": ["^build"], + "inputs": ["src/**/*.ts", "tests/e2e**/*.spec.ts"], "outputs": ["coverage/**"], "env": ["DISCORD_TOKEN", "E2E_TEST_GUILD_ID"] }, + "test:test-type": { + "dependsOn": ["^build:type"], + "inputs": ["src/**/*.ts", "tests/**/*.ts"] + }, + "test:type": { + "dependsOn": ["^build:type"], + "inputs": ["src/**/*.ts"] + }, "check": { "dependsOn": ["build:type"], "cache": false From 1b9394244b2f3813b6c372fc05dad7d13b783b72 Mon Sep 17 00:00:00 2001 From: Fleny Date: Wed, 7 Jan 2026 20:55:42 +0100 Subject: [PATCH 06/23] api-docs: Guild Role Member Counts endpoint (#4628) --- packages/bot/src/helpers.ts | 4 ++++ packages/rest/src/manager.ts | 4 ++++ packages/rest/src/routes.ts | 3 +++ packages/rest/src/types.ts | 10 ++++++++++ packages/rest/src/typings/routes.ts | 2 ++ 5 files changed, 23 insertions(+) diff --git a/packages/bot/src/helpers.ts b/packages/bot/src/helpers.ts index 5a7f2d492..52b1620d8 100644 --- a/packages/bot/src/helpers.ts +++ b/packages/bot/src/helpers.ts @@ -180,6 +180,9 @@ export function createBotHelpers { return await bot.rest.createInvite(channelId, options, reason) }, + getGuildRoleMemberCounts: async (guildId) => { + return await bot.rest.getGuildRoleMemberCounts(guildId) + }, createRole: async (guildId, options, reason) => { return bot.transformers.role(bot, snakelize(await bot.rest.createRole(guildId, options, reason)), { guildId }) }, @@ -866,6 +869,7 @@ export type BotHelpers Promise> createGuildTemplate: (guildId: BigString, options: CreateTemplate) => Promise