diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index ba4c1e23b..3c0736b59 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -63,6 +63,26 @@ jobs: github-token: ${{ secrets.github_token }} parallel-finished: true + test-leak: + name: Test (Leak Detection) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js v16 + uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Start MongoDB + uses: supercharge/mongodb-github-action@1.6.0 + with: + mongodb-version: 4.4 + - name: Update NPM + run: npm install --global npm@8 + - name: Bootstrap project + run: npm ci + - name: Run test + run: make leak-detection + code-lint: name: Code Lint runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 084a72a1f..97f984102 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ b benchmark benchmarks: .PHONY: l ld leak leak-detection l ld leak leak-detection: - npm i @airbnb/node-memwatch --no-save || npm i memwatch-next --no-save @ITERATIONS=$(ITERATIONS) $(TESTER) leak-detection \ --recursive \ --reporter spec \ diff --git a/leak-detection/leak-detector.test.js b/leak-detection/leak-detector.test.js index 9c0e5e701..1b9e67823 100644 --- a/leak-detection/leak-detector.test.js +++ b/leak-detection/leak-detector.test.js @@ -5,13 +5,7 @@ 'use strict'; -let memwatch; - -try { - memwatch = require('@airbnb/node-memwatch'); -} catch (e) { - memwatch = require('memwatch-next'); -} +const memwatch = require('@airbnb/node-memwatch'); const sinon = require('sinon'); describe('leak detector', function() { diff --git a/leak-detection/mongodb.test.js b/leak-detection/mongodb.test.js index de260eb79..01097a1b1 100644 --- a/leak-detection/mongodb.test.js +++ b/leak-detection/mongodb.test.js @@ -5,7 +5,7 @@ 'use strict'; -const memwatch = require('memwatch-next'); +const memwatch = require('@airbnb/node-memwatch'); const sinon = require('sinon'); const Todo = require('./fixtures/todo'); diff --git a/package-lock.json b/package-lock.json index 75fe18458..7657c9cb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "loopback-connector-mongodb", - "version": "6.0.1", + "version": "6.1.0", "license": "MIT", "dependencies": { "async": "^3.1.0", @@ -17,6 +17,7 @@ "strong-globalize": "^6.0.0" }, "devDependencies": { + "@airbnb/node-memwatch": "^2.0.0", "@commitlint/config-conventional": "^13.1.0", "benchmark": "^2.1.4", "bluebird": "^3.5.4", @@ -45,6 +46,20 @@ "should": "^13.2.3" } }, + "node_modules/@airbnb/node-memwatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@airbnb/node-memwatch/-/node-memwatch-2.0.0.tgz", + "integrity": "sha512-4DMP5GQz9ZYklB/FXiE1+yNffzjdiSerpr10QGxBQF56xcZsKLE0PnL/Pq6yC1sLGT0IHgG4UXgz/a5Yd463gw==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.5.0", + "nan": "^2.14.1" + }, + "engines": { + "node": ">= 10.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", @@ -792,6 +807,15 @@ "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==", + "dev": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", @@ -1803,6 +1827,12 @@ "node": "^10.12.0 || >=12.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==", + "dev": true + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3299,6 +3329,12 @@ "safe-buffer": "^5.1.2" } }, + "node_modules/nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true + }, "node_modules/nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", @@ -5567,6 +5603,16 @@ } }, "dependencies": { + "@airbnb/node-memwatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@airbnb/node-memwatch/-/node-memwatch-2.0.0.tgz", + "integrity": "sha512-4DMP5GQz9ZYklB/FXiE1+yNffzjdiSerpr10QGxBQF56xcZsKLE0PnL/Pq6yC1sLGT0IHgG4UXgz/a5Yd463gw==", + "dev": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.14.1" + } + }, "@babel/code-frame": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", @@ -6161,6 +6207,15 @@ "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==", + "dev": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.1.tgz", @@ -6958,6 +7013,12 @@ "flat-cache": "^3.0.4" } }, + "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==", + "dev": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8094,6 +8155,12 @@ "safe-buffer": "^5.1.2" } }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true + }, "nanoid": { "version": "2.1.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", diff --git a/package.json b/package.json index ad3eed643..b251acc88 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "strong-globalize": "^6.0.0" }, "devDependencies": { + "@airbnb/node-memwatch": "^2.0.0", "@commitlint/config-conventional": "^13.1.0", "benchmark": "^2.1.4", "bluebird": "^3.5.4",