Skip to content

Commit

Permalink
test(NODE-4333): add unit test to check dependencies (#3361)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 16, 2022
1 parent a0c7f5c commit 6425c7a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check Dependencies

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run check:dependencies
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd",
"check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
"check:tsd": "tsd --version && tsd",
"check:dependencies": "mocha test/unit/dependency.test.ts",
"check:dts": "node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd",
"check:test": "mocha --config test/mocha_mongodb.json test/integration",
"check:unit": "mocha test/unit",
Expand Down
13 changes: 13 additions & 0 deletions test/unit/dependency.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect } from 'chai';

import { dependencies } from '../../package.json';

const EXPECTED_DEPENDENCIES = ['bson', 'denque', 'mongodb-connection-string-url', 'socks'];

describe('package.json', function () {
describe('dependencies', function () {
it('only contains the expected dependencies', function () {
expect(Object.getOwnPropertyNames(dependencies)).to.deep.equal(EXPECTED_DEPENDENCIES);
});
});
});

0 comments on commit 6425c7a

Please sign in to comment.