Skip to content

Commit

Permalink
Merge branch 'main' into COMPASS-8082-multiple-kms-providers
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit authored Sep 6, 2024
2 parents 8525f23 + 8671616 commit b1e0b6b
Show file tree
Hide file tree
Showing 96 changed files with 1,199 additions and 456 deletions.
6 changes: 5 additions & 1 deletion .evergreen/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ functions:
--stream \
--scope "${scope}" \
--include-dependencies
# If scope is not provided, we're bootstrapping the whole monorepo and
# should follow the logic in bootstrap npm scripts
if [ -z "${scope}" ]; then
npm run compile --workspace=@mongodb-js/testing-library-compass
fi
check:
command: shell.exec
params:
Expand Down
8 changes: 4 additions & 4 deletions THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The following third-party software is used by and included in **Mongodb Compass**.
This document was automatically generated on Tue Sep 03 2024.
This document was automatically generated on Thu Sep 05 2024.

## List of dependencies

Expand Down Expand Up @@ -464,7 +464,7 @@ This document was automatically generated on Tue Sep 03 2024.
| **[modify-filename](#7153be07939379ccf0072006c519fba2bdf5ab79ca8bb59bc5273f87a7bacbf6)** | 1.1.0 | MIT |
| **[moment](#94975b5423311209f3beed9c2c6bb6157f622312a3f8563d507b52e804bf6285)** | 2.29.4 | MIT |
| **[mongodb-build-info](#f0a98c22ae0766702726f79e058ac6dc4e4bead8557b67b816f40bd13fb54170)** | 1.7.2 | Apache-2.0 |
| **[mongodb-client-encryption](#42ba122fc0db7791e33e6160aff7213f42c4a34a8e891e78cd07c606555c2bb9)** | 6.0.1 | Apache-2.0 |
| **[mongodb-client-encryption](#01c104ff07b0715f77217b6b7adfc9a0056f35ffd976182ffbf409f69b3a0df3)** | 6.1.0 | Apache-2.0 |
| **[mongodb-cloud-info](#a784f3b401cf51746f49964e044db933529b3e3791e557702715730f5a3f1e46)** | 2.1.2 | Apache-2.0 |
| **[mongodb-connection-string-url](#2e1146256a89ebd24e3398881e03807fe363d58444e6b7952ea50bd6108707bc)** | 3.0.1 | Apache-2.0 |
| **[mongodb-log-writer](#c4945018f8490fc8e56e1414e262fcf1b802800e05cd15f2bd6b7a9d0b94af85)** | 1.4.2 | Apache-2.0 |
Expand Down Expand Up @@ -27448,9 +27448,9 @@ License files:
See the License for the specific language governing permissions and
limitations under the License.

<a id="42ba122fc0db7791e33e6160aff7213f42c4a34a8e891e78cd07c606555c2bb9"></a>
<a id="01c104ff07b0715f77217b6b7adfc9a0056f35ffd976182ffbf409f69b3a0df3"></a>

### [mongodb-client-encryption](https://www.npmjs.com/package/mongodb-client-encryption) (version 6.0.1)
### [mongodb-client-encryption](https://www.npmjs.com/package/mongodb-client-encryption) (version 6.1.0)

License tags: Apache-2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@ const path = require('path');
const Module = require('module');

const workspacesDirPath = path.resolve(__dirname, '..', '..', '..', 'packages');
if (!fs.existsSync(workspacesDirPath)) {
const configsDirPath = path.resolve(__dirname, '..', '..', '..', 'configs');

if (!fs.existsSync(workspacesDirPath) || !fs.existsSync(configsDirPath)) {
// Not running inside the Compass monorepo
return;
}

const workspaces = fs
.readdirSync(workspacesDirPath)
.filter((workspacesDir) => {
// Unexpected but seems to be a thing that happens? Ignore hidden files
return !workspacesDir.startsWith('.');
})
.map((workspaceName) => path.join(workspacesDirPath, workspaceName));
const getPackagePathsFromDir = (dirPath) => {
return fs
.readdirSync(dirPath)
.filter((dir) => {
// Unexpected but seems to be a thing that happens? Ignore hidden files
return !dir.startsWith('.');
})
.map((name) => path.join(dirPath, name));
};

const workspaces = [
...getPackagePathsFromDir(workspacesDirPath),
...getPackagePathsFromDir(configsDirPath),
];

const sourcePaths = Object.fromEntries(
workspaces
Expand Down
21 changes: 21 additions & 0 deletions configs/testing-library-compass/.depcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ignores:
- '@mongodb-js/prettier-config-compass'
- '@mongodb-js/tsconfig-compass'
- '@types/chai'
- '@types/sinon-chai'
- 'sinon'
# This package relies on some other compass packages to function, but adding a
# dependency will introduce a circular one in our dependency tree, as it's only
# used for testing and doesn't require compilation, we're escaping the
# recursiveness issue by just not including those in the package.json
- '@mongodb-js/compass-logging'
- '@mongodb-js/compass-telemetry'
- '@mongodb-js/connection-info'
- '@mongodb-js/compass-connections'
- '@mongodb-js/compass-components'
- '@mongodb-js/connection-storage'
- 'compass-preferences-model'
- 'hadron-app-registry'
- 'mongodb-data-service'
ignore-patterns:
- 'dist'
2 changes: 2 additions & 0 deletions configs/testing-library-compass/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.nyc-output
dist
8 changes: 8 additions & 0 deletions configs/testing-library-compass/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
root: true,
extends: ['@mongodb-js/eslint-config-compass'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig-lint.json'],
},
};
1 change: 1 addition & 0 deletions configs/testing-library-compass/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@mongodb-js/mocha-config-compass');
3 changes: 3 additions & 0 deletions configs/testing-library-compass/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.nyc_output
dist
coverage
1 change: 1 addition & 0 deletions configs/testing-library-compass/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@mongodb-js/prettier-config-compass"
71 changes: 71 additions & 0 deletions configs/testing-library-compass/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "@mongodb-js/testing-library-compass",
"description": "Compass unit testing utils",
"author": {
"name": "MongoDB Inc",
"email": "[email protected]"
},
"private": true,
"bugs": {
"url": "https://jira.mongodb.org/projects/COMPASS/issues",
"email": "[email protected]"
},
"homepage": "https://github.com/mongodb-js/compass",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/mongodb-js/compass.git"
},
"files": [
"dist"
],
"license": "SSPL",
"main": "dist/index.js",
"compass:main": "src/index.tsx",
"exports": {
".": "./dist/index.js"
},
"compass:exports": {
".": "./src/index.tsx"
},
"types": "./dist/index.d.ts",
"scripts": {
"compile": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig-lint.json --noEmit",
"eslint": "eslint",
"prettier": "prettier",
"lint": "npm run eslint . && npm run prettier -- --check .",
"depcheck": "depcheck",
"check": "npm run typecheck && npm run lint && npm run depcheck",
"check-ci": "npm run check",
"test": "mocha",
"test-cov": "nyc --compact=false --produce-source-map=false -x \"**/*.spec.*\" --reporter=lcov --reporter=text --reporter=html npm run test",
"test-watch": "npm run test -- --watch",
"test-ci": "npm run test-cov",
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "^1.1.6",
"@mongodb-js/mocha-config-compass": "^1.4.1",
"@mongodb-js/prettier-config-compass": "^1.0.2",
"@mongodb-js/tsconfig-compass": "^1.0.4",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/sinon-chai": "^3.2.5",
"chai": "^4.3.6",
"depcheck": "^1.4.1",
"eslint": "^7.25.0",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"typescript": "^5.0.4"
},
"dependencies": {
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"mongodb-connection-string-url": "^3.0.1",
"react": "^17.0.2",
"react-redux": "^8.1.3",
"sinon": "^17.0.1"
}
}
11 changes: 11 additions & 0 deletions configs/testing-library-compass/src/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('helper methods', function () {
describe('render', function () {});

describe('renderHook', function () {});

describe('renderWithActiveConnection', function () {});

describe('renderHookWithActiveConnection', function () {});

describe('renderHookWithActiveConnection', function () {});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* TODO: move this to mocha-config-compass package
*/
import { EventEmitter } from 'events';
import {
createNoopLogger,
Expand All @@ -21,6 +18,7 @@ import {
waitForElementToBeRemoved,
act,
within,
fireEvent as testingLibraryFireEvent,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import type {
Expand All @@ -43,12 +41,17 @@ import { CompassComponentsProvider } from '@mongodb-js/compass-components';
import {
ConnectionInfoProvider,
TEST_CONNECTION_INFO,
} from './connection-info-provider';
import type { State } from './stores/connections-store-redux';
import { createDefaultConnectionInfo } from './stores/connections-store-redux';
import { getDataServiceForConnection } from './stores/connections-store-redux';
import { useConnectionActions, useStore } from './stores/store-context';
import CompassConnections, { ConnectFnProvider } from './index';
} from '@mongodb-js/compass-connections/src/connection-info-provider';
import type { State } from '@mongodb-js/compass-connections/src/stores/connections-store-redux';
import { createDefaultConnectionInfo } from '@mongodb-js/compass-connections/src/stores/connections-store-redux';
import { getDataServiceForConnection } from '@mongodb-js/compass-connections/src/stores/connections-store-redux';
import {
useConnectionActions,
useStore,
} from '@mongodb-js/compass-connections/src/stores/store-context';
import CompassConnections, {
ConnectFnProvider,
} from '@mongodb-js/compass-connections/src/index';
import type { HadronPluginComponent, HadronPlugin } from 'hadron-app-registry';
import AppRegistry, {
AppRegistryProvider,
Expand Down Expand Up @@ -669,6 +672,11 @@ async function activatePluginWithActiveConnection<
return { plugin: result.current, ...rest };
}

/**
* @deprecated use userEvent instead
*/
const fireEvent = testingLibraryFireEvent;

export {
// There is never a good reason not to have these wrapper providers when
// rendering something in compass for testing. Using these render methods
Expand All @@ -695,4 +703,5 @@ export {
createDefaultConnectionInfo,
userEvent,
within,
fireEvent,
};
5 changes: 5 additions & 0 deletions configs/testing-library-compass/tsconfig-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["**/*"],
"exclude": ["node_modules", "dist"]
}
10 changes: 10 additions & 0 deletions configs/testing-library-compass/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "@mongodb-js/tsconfig-compass/tsconfig.react.json",
"compilerOptions": {
"outDir": "dist",
// Because of the recursive deps
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["./src/**/*.spec.*"]
}
Loading

0 comments on commit b1e0b6b

Please sign in to comment.