diff --git a/.github/docker/Dockerfile.glibc b/.github/docker/Dockerfile.glibc index e0a89d3..b22a180 100644 --- a/.github/docker/Dockerfile.glibc +++ b/.github/docker/Dockerfile.glibc @@ -16,7 +16,7 @@ RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd RUN npm run install:libmongocrypt ARG RUN_TEST -RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!' +RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi FROM scratch diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd07514..3c74b60 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,7 @@ jobs: matrix: os: [macos-latest, windows-2019] node: [16.x, 18.x, 20.x, 22.x] + fail-fast: false runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -20,8 +21,8 @@ jobs: - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - cache: 'npm' - registry-url: 'https://registry.npmjs.org' + cache: "npm" + registry-url: "https://registry.npmjs.org" - name: Build with Node.js ${{ matrix.node }} on ${{ matrix.os }} run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }} @@ -37,6 +38,7 @@ jobs: matrix: linux_arch: [s390x, arm64, amd64] node: [16.x, 18.x, 20.x, 22.x] + fail-fast: false steps: - uses: actions/checkout@v4 diff --git a/.mocharc.json b/.mocharc.json index 33df4eb..13b5622 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -11,5 +11,6 @@ "recursive": true, "failZero": true, "reporter": "test/tools/mongodb_reporter.js", - "color": true -} + "color": true, + "timeout": 0 +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 548a558..8914301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" }, @@ -1581,14 +1580,6 @@ "node": ">=8" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -3405,11 +3396,6 @@ "node": ">=16.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -9353,14 +9339,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -10763,11 +10741,6 @@ "flat-cache": "^4.0.0" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index 175b60d..92da208 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "gypfile": true, "mongodb:libmongocrypt": "1.11.0", "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" }, @@ -97,4 +96,4 @@ "moduleResolution": "node" } } -} +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 85ab3d2..ab43cb4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,15 @@ import { cryptoCallbacks } from './crypto_callbacks'; export { cryptoCallbacks }; -import bindings = require('bindings'); -const mc: MongoCryptBindings = bindings('mongocrypt'); +function load() { + try { + return require('../build/Release/mongocrypt.node'); + } catch { + return require('../build/Debug/mongocrypt.node'); + } +} + +const mc: MongoCryptBindings = load(); /** * The value returned by the native bindings