mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
ci: Use mocha for both deno and bun (#4067)
* Use mocha for both deno and bun * Use any Bun 1.1 * remove build:type dependency in lib-check.yml * Pin point 1.1.42 * remove packages/bot/.mocharc.json
This commit is contained in:
14
.github/workflows/lib-check.yml
vendored
14
.github/workflows/lib-check.yml
vendored
@@ -135,7 +135,7 @@ jobs:
|
|||||||
# Not using matrix because test later on cant needs a specific job
|
# Not using matrix because test later on cant needs a specific job
|
||||||
bot-unit-test:
|
bot-unit-test:
|
||||||
name: Bot
|
name: Bot
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -159,7 +159,7 @@ jobs:
|
|||||||
|
|
||||||
discordeno-unit-test:
|
discordeno-unit-test:
|
||||||
name: Discordeno
|
name: Discordeno
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -174,7 +174,7 @@ jobs:
|
|||||||
|
|
||||||
gateway-unit-test:
|
gateway-unit-test:
|
||||||
name: Gateway
|
name: Gateway
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -188,7 +188,7 @@ jobs:
|
|||||||
package: gateway
|
package: gateway
|
||||||
gateway-other-runtime-test:
|
gateway-other-runtime-test:
|
||||||
name: Gateway
|
name: Gateway
|
||||||
needs: [gateway-unit-test, gateway-integration-test]
|
needs: [gateway-unit-test]
|
||||||
uses: ./.github/workflows/other-runtime-unit-test.yml
|
uses: ./.github/workflows/other-runtime-unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -196,7 +196,7 @@ jobs:
|
|||||||
|
|
||||||
rest-unit-test:
|
rest-unit-test:
|
||||||
name: Rest
|
name: Rest
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
|
|
||||||
types-unit-test:
|
types-unit-test:
|
||||||
name: Types
|
name: Types
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
@@ -235,7 +235,7 @@ jobs:
|
|||||||
|
|
||||||
utils-unit-test:
|
utils-unit-test:
|
||||||
name: Utils
|
name: Utils
|
||||||
needs: [build-dist, build-type-and-test]
|
needs: [build-dist]
|
||||||
uses: ./.github/workflows/unit-test.yml
|
uses: ./.github/workflows/unit-test.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
|
|||||||
27
.github/workflows/other-runtime-unit-test.yml
vendored
27
.github/workflows/other-runtime-unit-test.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
- uses: denoland/setup-deno@main
|
- uses: denoland/setup-deno@v2
|
||||||
with:
|
with:
|
||||||
deno-version: 'v1.29'
|
deno-version: 'v2.1.x'
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||||
@@ -41,21 +41,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: .turbo
|
path: .turbo
|
||||||
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
|
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
|
||||||
- name: Build type cache
|
|
||||||
if: steps.turbo-cache.outputs.cache-hit != 'true'
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: .turbo
|
|
||||||
key: ${{ runner.os }}-turbo-build:type-${{ github.sha }}
|
|
||||||
- name: Deno cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.deno
|
|
||||||
~/.cache/deno
|
|
||||||
key: ${{ runner.os }}-deno-${{ inputs.package }}-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-deno-${{ inputs.package }}
|
|
||||||
- name: Deno Unit Test
|
- name: Deno Unit Test
|
||||||
run: yarn test:deno-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }}
|
run: yarn test:deno-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }}
|
||||||
bun-unit-test:
|
bun-unit-test:
|
||||||
@@ -68,7 +53,7 @@ jobs:
|
|||||||
node-version: 18
|
node-version: 18
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: '1.0.6'
|
bun-version: '1.1.42'
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||||
@@ -91,12 +76,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: .turbo
|
path: .turbo
|
||||||
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
|
key: ${{ runner.os }}-turbo-build-${{ github.sha }}
|
||||||
- name: Build type cache
|
|
||||||
if: steps.turbo-cache.outputs.cache-hit != 'true'
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: .turbo
|
|
||||||
key: ${{ runner.os }}-turbo-build:type-${{ github.sha }}
|
|
||||||
- name: Bun Unit Test
|
- name: Bun Unit Test
|
||||||
run: yarn test:bun-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }}
|
run: yarn test:bun-unit --cache-dir=".turbo" --filter=./packages/${{ inputs.package }}
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
|
|||||||
9
.mocharc.base.cjs
Normal file
9
.mocharc.base.cjs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// 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,
|
||||||
|
}
|
||||||
6
.mocharc.cjs
Normal file
6
.mocharc.cjs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
...require('./.mocharc.base.cjs'),
|
||||||
|
require: 'ts-node/register',
|
||||||
|
loader: 'ts-node/esm',
|
||||||
|
'enable-source-maps': true,
|
||||||
|
}
|
||||||
13
.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch
Normal file
13
.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/lib/cli/cli.js b/lib/cli/cli.js
|
||||||
|
index 5a4c6b8d53e8a01eca68b6d9d03b0f11626e77c1..2be60285c6c855417af39fb4b28b7f2928783312 100644
|
||||||
|
--- a/lib/cli/cli.js
|
||||||
|
+++ b/lib/cli/cli.js
|
||||||
|
@@ -12,7 +12,7 @@
|
||||||
|
|
||||||
|
const debug = require('debug')('mocha:cli:cli');
|
||||||
|
const symbols = require('log-symbols');
|
||||||
|
-const yargs = require('yargs/yargs');
|
||||||
|
+const yargs = require('yargs');
|
||||||
|
const path = require('path');
|
||||||
|
const {
|
||||||
|
loadRc,
|
||||||
6
deno.json
Normal file
6
deno.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json",
|
||||||
|
"nodeModulesDir": "manual",
|
||||||
|
"lock": false,
|
||||||
|
"unstable": ["sloppy-imports"]
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"imports": {
|
|
||||||
"node:buffer": "https://deno.land/std@0.176.0/node/buffer.ts",
|
|
||||||
"node:crypto": "https://deno.land/std@0.176.0/node/crypto.ts",
|
|
||||||
"node:fs": "https://deno.land/std@0.176.0/node/fs.ts",
|
|
||||||
"node:fs/promises": "https://deno.land/std@0.176.0/node/fs/promises.ts",
|
|
||||||
"node:events": "https://deno.land/std@0.176.0/node/events.ts",
|
|
||||||
"tweetnacl": "npm:tweetnacl",
|
|
||||||
"ws": "npm:ws",
|
|
||||||
"fzstd": "npm:fzstd",
|
|
||||||
"mocha": "https://deno.land/std@0.168.0/testing/bdd.ts",
|
|
||||||
"chai": "https://cdn.skypack.dev/chai@4.3.4?dts",
|
|
||||||
"sinon": "https://cdn.skypack.dev/sinon@15.0.0?dts",
|
|
||||||
"find-up": "npm:find-up",
|
|
||||||
"typescript": "npm:typescript",
|
|
||||||
"chai-as-promised": "npm:chai-as-promised",
|
|
||||||
"benchmark": "npm:benchmark",
|
|
||||||
"dotenv": "npm:dotenv",
|
|
||||||
"node:zlib": "https://deno.land/std@0.176.0/node/zlib.ts",
|
|
||||||
"node:assert": "https://deno.land/std@0.176.0/node/assert.ts",
|
|
||||||
"node:path": "https://deno.land/std@0.176.0/node/path.ts",
|
|
||||||
"node:url": "https://deno.land/std@0.176.0/node/url.ts",
|
|
||||||
"@discordeno/utils": "./packages/utils/dist/esm/index.js",
|
|
||||||
"@discordeno/types": "./packages/types/dist/esm/index.js",
|
|
||||||
"@discordeno/rest": "./packages/rest/dist/esm/index.js",
|
|
||||||
"@discordeno/gateway": "./packages/gateway/dist/esm/index.js",
|
|
||||||
"@discordeno/bot": "./packages/bot/dist/esm/index.js"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,10 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno",
|
||||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
|
||||||
"test:e2e": "c8 --r lcov mocha --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"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:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tests/tsconfig.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"chai": "^5.1.2",
|
"chai": "^5.1.2",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"sinon": "^19.0.2",
|
"sinon": "^19.0.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js discordeno",
|
||||||
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
|
||||||
"test:bun-unit": "node ../../scripts/fixBunTestExtension.js && bun test bunTestsDist",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
"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:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tests/tsconfig.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"@types/node": "^22.10.3",
|
"@types/node": "^22.10.3",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"chai": "^5.1.2",
|
"chai": "^5.1.2",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,8 +22,9 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
||||||
"test:deno-unit": "swc --strip-leading-paths tests --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"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 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
"test:integration": "c8 --r lcov mocha --no-warnings 'tests/integration/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js gateway",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tests/tsconfig.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
"@types/ws": "^8.5.13",
|
"@types/ws": "^8.5.13",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"chai": "^5.1.2",
|
"chai": "^5.1.2",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"sinon": "^19.0.2",
|
"sinon": "^19.0.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/unit/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/unit/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
||||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist/unit",
|
|
||||||
"test:bun-unit": "node ../../scripts/fixBunTestExtension.js && bun test bunTestsDist/unit",
|
|
||||||
"test:e2e": "c8 --r lcov mocha --exit --no-warnings --jobs 1 --t 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/unit/**/*.spec.ts'",
|
"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 30000 'tests/e2e/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js rest",
|
||||||
"test:type": "tsc --noEmit",
|
"test:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tests/tsconfig.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"chai": "^5.1.2",
|
"chai": "^5.1.2",
|
||||||
"chai-as-promised": "^8.0.1",
|
"chai-as-promised": "^8.0.1",
|
||||||
"dotenv": "^16.4.7",
|
"dotenv": "^16.4.7",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"sinon": "^19.0.2",
|
"sinon": "^19.0.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,8 +22,9 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils",
|
||||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
"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:type": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -33,7 +34,7 @@
|
|||||||
"@types/mocha": "^10.0.10",
|
"@types/mocha": "^10.0.10",
|
||||||
"@types/node": "^22.10.3",
|
"@types/node": "^22.10.3",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"require": "ts-node/register",
|
|
||||||
"loader": "ts-node/esm",
|
|
||||||
"recursive": true,
|
|
||||||
"timeout": 2000,
|
|
||||||
"watch-extensions": "ts",
|
|
||||||
"watch-files": ["src", "tests"],
|
|
||||||
"enable-source-maps": true,
|
|
||||||
"parallel": false
|
|
||||||
}
|
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
"lint": "biome lint --write",
|
"lint": "biome lint --write",
|
||||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
|
"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": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils",
|
||||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
|
||||||
"test:bun-unit": "node ../../scripts/fixBunTestExtension.js && bun test bunTestsDist",
|
|
||||||
"test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
|
"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:type": "tsc --noEmit",
|
||||||
"test:test-type": "tsc --project tests/tsconfig.json"
|
"test:test-type": "tsc --project tests/tsconfig.json"
|
||||||
},
|
},
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"c8": "^10.1.3",
|
"c8": "^10.1.3",
|
||||||
"chai": "^5.1.2",
|
"chai": "^5.1.2",
|
||||||
"mocha": "^11.0.1",
|
"mocha": "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch",
|
||||||
"sinon": "^19.0.2",
|
"sinon": "^19.0.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsconfig": "*",
|
"tsconfig": "*",
|
||||||
|
|||||||
@@ -15,14 +15,12 @@ describe('bucket.ts', () => {
|
|||||||
let clock: sinon.SinonFakeTimers
|
let clock: sinon.SinonFakeTimers
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
console.log('before')
|
|
||||||
clock = sinon.useFakeTimers()
|
clock = sinon.useFakeTimers()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
sinon.restore()
|
sinon.restore()
|
||||||
clock.restore()
|
clock.restore()
|
||||||
console.log('after')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('LeakyBucket function', () => {
|
describe('LeakyBucket function', () => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ describe('urlToBase64.ts', () => {
|
|||||||
let fetchStub: sinon.SinonStub
|
let fetchStub: sinon.SinonStub
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fetchStub = sinon.stub(typeof global !== 'undefined' ? global : window, 'fetch')
|
fetchStub = sinon.stub(globalThis, 'fetch')
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import fs from 'node:fs'
|
|
||||||
|
|
||||||
const dirs = ['']
|
|
||||||
try {
|
|
||||||
fs.rmSync('bunTestsDist', { recursive: true, force: true })
|
|
||||||
} catch {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
for await (const dir of dirs) {
|
|
||||||
await Promise.all(
|
|
||||||
fs.readdirSync(`tests${dir}`).map(async (file) => {
|
|
||||||
if (!file.endsWith('.ts') && !file.includes('.')) {
|
|
||||||
dirs.push(`${dir}/${file}`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const content = await fs.promises.readFile(`tests${dir}/${file}`, 'utf-8')
|
|
||||||
fs.mkdirSync(`bunTestsDist${dir}`, { recursive: true })
|
|
||||||
fs.promises.writeFile(`bunTestsDist${dir}/${file}`, content.replace(/'mocha'/g, "'bun:test'"))
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import fs from 'node:fs'
|
|
||||||
|
|
||||||
const dirs = ['']
|
|
||||||
for await (const dir of dirs) {
|
|
||||||
await Promise.all(
|
|
||||||
fs.readdirSync(`denoTestsDist${dir}`).map(async (file) => {
|
|
||||||
if (!file.endsWith('.js') && !file.endsWith('.map') && !file.endsWith('.ts')) {
|
|
||||||
dirs.push(`${dir}/${file}`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const content = await fs.promises.readFile(`denoTestsDist${dir}/${file}`, 'utf-8')
|
|
||||||
await fs.promises.rm(`denoTestsDist${dir}/${file}`)
|
|
||||||
fs.promises.writeFile(
|
|
||||||
`denoTestsDist${dir}/${file.slice(-8) === '.spec.js' ? `${file.slice(0, -7)}test.js` : file}`,
|
|
||||||
content
|
|
||||||
.replace(/src\//g, 'dist/esm/')
|
|
||||||
.replace(/describe\.skip/g, 'describe.ignore')
|
|
||||||
.replace(/it\.skip/g, 'it.ignore'),
|
|
||||||
)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"outputs": ["coverage/**"]
|
"outputs": ["coverage/**"]
|
||||||
},
|
},
|
||||||
"test:unit": {
|
"test:unit": {
|
||||||
"dependsOn": ["^build", "build", "build:type"],
|
"dependsOn": ["^build", "build"],
|
||||||
"outputs": ["coverage/**"]
|
"outputs": ["coverage/**"]
|
||||||
},
|
},
|
||||||
"test:integration": {
|
"test:integration": {
|
||||||
@@ -25,12 +25,10 @@
|
|||||||
"dependsOn": ["^build:type"]
|
"dependsOn": ["^build:type"]
|
||||||
},
|
},
|
||||||
"test:deno-unit": {
|
"test:deno-unit": {
|
||||||
"dependsOn": ["^build", "build", "build:type"],
|
"dependsOn": ["^build", "build"]
|
||||||
"outputs": ["denoTestsDist/**"]
|
|
||||||
},
|
},
|
||||||
"test:bun-unit": {
|
"test:bun-unit": {
|
||||||
"dependsOn": ["^build", "build", "build:type"],
|
"dependsOn": ["^build", "build"]
|
||||||
"outputs": ["bunTestsDist/**"]
|
|
||||||
},
|
},
|
||||||
"test:e2e": {
|
"test:e2e": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["^build"],
|
||||||
|
|||||||
45
yarn.lock
45
yarn.lock
@@ -129,7 +129,7 @@ __metadata:
|
|||||||
"@types/sinon": "npm:^17.0.3"
|
"@types/sinon": "npm:^17.0.3"
|
||||||
c8: "npm:^10.1.3"
|
c8: "npm:^10.1.3"
|
||||||
chai: "npm:^5.1.2"
|
chai: "npm:^5.1.2"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
sinon: "npm:^19.0.2"
|
sinon: "npm:^19.0.2"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
@@ -154,7 +154,7 @@ __metadata:
|
|||||||
c8: "npm:^10.1.3"
|
c8: "npm:^10.1.3"
|
||||||
chai: "npm:^5.1.2"
|
chai: "npm:^5.1.2"
|
||||||
fzstd: "npm:^0.1.1"
|
fzstd: "npm:^0.1.1"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
sinon: "npm:^19.0.2"
|
sinon: "npm:^19.0.2"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
@@ -185,7 +185,7 @@ __metadata:
|
|||||||
chai: "npm:^5.1.2"
|
chai: "npm:^5.1.2"
|
||||||
chai-as-promised: "npm:^8.0.1"
|
chai-as-promised: "npm:^8.0.1"
|
||||||
dotenv: "npm:^16.4.7"
|
dotenv: "npm:^16.4.7"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
sinon: "npm:^19.0.2"
|
sinon: "npm:^19.0.2"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
@@ -203,7 +203,7 @@ __metadata:
|
|||||||
"@types/mocha": "npm:^10.0.10"
|
"@types/mocha": "npm:^10.0.10"
|
||||||
"@types/node": "npm:^22.10.3"
|
"@types/node": "npm:^22.10.3"
|
||||||
c8: "npm:^10.1.3"
|
c8: "npm:^10.1.3"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:^5.7.2"
|
typescript: "npm:^5.7.2"
|
||||||
@@ -224,7 +224,7 @@ __metadata:
|
|||||||
"@types/sinon": "npm:^17.0.3"
|
"@types/sinon": "npm:^17.0.3"
|
||||||
c8: "npm:^10.1.3"
|
c8: "npm:^10.1.3"
|
||||||
chai: "npm:^5.1.2"
|
chai: "npm:^5.1.2"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
sinon: "npm:^19.0.2"
|
sinon: "npm:^19.0.2"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
@@ -1878,7 +1878,7 @@ __metadata:
|
|||||||
"@types/node": "npm:^22.10.3"
|
"@types/node": "npm:^22.10.3"
|
||||||
c8: "npm:^10.1.3"
|
c8: "npm:^10.1.3"
|
||||||
chai: "npm:^5.1.2"
|
chai: "npm:^5.1.2"
|
||||||
mocha: "npm:^11.0.1"
|
mocha: "patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch"
|
||||||
ts-node: "npm:^10.9.2"
|
ts-node: "npm:^10.9.2"
|
||||||
tsconfig: "npm:*"
|
tsconfig: "npm:*"
|
||||||
typescript: "npm:^5.7.2"
|
typescript: "npm:^5.7.2"
|
||||||
@@ -3163,7 +3163,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"mocha@npm:^11.0.1":
|
"mocha@npm:11.0.2":
|
||||||
version: 11.0.2
|
version: 11.0.2
|
||||||
resolution: "mocha@npm:11.0.2"
|
resolution: "mocha@npm:11.0.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3194,6 +3194,37 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"mocha@patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch":
|
||||||
|
version: 11.0.2
|
||||||
|
resolution: "mocha@patch:mocha@npm%3A11.0.2#~/.yarn/patches/mocha-npm-11.0.2-b5d6b95284.patch::version=11.0.2&hash=15fdee"
|
||||||
|
dependencies:
|
||||||
|
ansi-colors: "npm:^4.1.3"
|
||||||
|
browser-stdout: "npm:^1.3.1"
|
||||||
|
chokidar: "npm:^3.5.3"
|
||||||
|
debug: "npm:^4.3.5"
|
||||||
|
diff: "npm:^5.2.0"
|
||||||
|
escape-string-regexp: "npm:^4.0.0"
|
||||||
|
find-up: "npm:^5.0.0"
|
||||||
|
glob: "npm:^10.4.5"
|
||||||
|
he: "npm:^1.2.0"
|
||||||
|
js-yaml: "npm:^4.1.0"
|
||||||
|
log-symbols: "npm:^4.1.0"
|
||||||
|
minimatch: "npm:^5.1.6"
|
||||||
|
ms: "npm:^2.1.3"
|
||||||
|
serialize-javascript: "npm:^6.0.2"
|
||||||
|
strip-json-comments: "npm:^3.1.1"
|
||||||
|
supports-color: "npm:^8.1.1"
|
||||||
|
workerpool: "npm:^6.5.1"
|
||||||
|
yargs: "npm:^16.2.0"
|
||||||
|
yargs-parser: "npm:^20.2.9"
|
||||||
|
yargs-unparser: "npm:^2.0.0"
|
||||||
|
bin:
|
||||||
|
_mocha: bin/_mocha
|
||||||
|
mocha: bin/mocha.js
|
||||||
|
checksum: 02b3a6136d6223dd90204de2ef0e724b3e0672b788328a9313d1e45a7b07a78d4c1a03ef04e560ac37703db1eaa7b1d9c5ee2e9ad9ca52c3d8dc49507b6e208e
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"ms@npm:2.1.2":
|
"ms@npm:2.1.2":
|
||||||
version: 2.1.2
|
version: 2.1.2
|
||||||
resolution: "ms@npm:2.1.2"
|
resolution: "ms@npm:2.1.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user