You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,123 +11,29 @@ please follow it in all your interactions with the project.
11
11
12
12
### Runtime
13
13
14
-
It's recommended you install Node Version Manager for [unix systems][nvm-unix] or [windows][nvm-windows]. While it isn't required we have a minimum node version requirement (look in package.json under the "engines" key) and we can't accept code that does not work on the minimum specified version.
14
+
It's recommended you install Node Version Manager for [unix systems][nvm-unix] or [windows][nvm-windows].
15
+
While it isn't required we have a minimum node version requirement (look in [package.json](./package.json) under the "engines" key) and we can't accept code that does not work on the minimum specified version.
15
16
16
17
### MongoDB Helpers
17
18
18
-
-To get various MongoDB topologies up and running easily you can use the python based tool[mtools][mtools-install].
19
-
-To get various versions of MongoDB to test against you can use [m](https://github.com/aheckmann/m) an npm tool best installed globally `npm i -g m`.
19
+
-For setting up a cluster to test against we recommend using[mtools][mtools-install].
20
+
-For managing installed versions of MongoDB, we recommend using [m](https://github.com/aheckmann/m).
20
21
21
22
### VSCode Setup
22
23
23
-
If you are developing in VSCode here's some suggestions:
24
-
We have an example of our workspace file: save this as `mongodbNodeDriver.code-workspace` and replace PATH_TO_DRIVER with the path to the driver repository on your computer.
If you use this file you will get our recommended extensions suggested to you.
130
-
If not, we recommend picking up `dbaeumer.vscode-eslint` at least to make sure any additional code is following style recommendations. If you don't want to use this workspace file but still don't want to think about formatting you can have VSCode do the checks and formatting work for you by adding just these settings:
36
+
If you just want to get formatting and linting working automatically use these settings:
131
37
132
38
```jsonc
133
39
"settings":{
@@ -145,17 +51,21 @@ If not, we recommend picking up `dbaeumer.vscode-eslint` at least to make sure a
145
51
146
52
### Running the tests
147
53
148
-
Running the tests:
54
+
- Start a mongod standalone with our [cluster_setup.sh](test/tools/cluster_setup.sh) script
55
+
- Usage: `./test/tools/cluster_setup.sh server`
56
+
- Run the tests with `npm test`
57
+
58
+
### Tests FAQ
149
59
150
-
- You can use the script: `test/tools/cluster_setup.sh server`
151
-
- If you are running against more than a standalone make sure your ulimit settings are in accordance with mongo's recommendations
60
+
- How can I run the tests against more than a standalone?
61
+
- You can use the `test/tools/cluster_setup.sh replica_set`
62
+
- You can prefix the npm test with a MONGODB_URI environment variable to point the tests to the correct deployment
- If you are running against more than a standalone make sure your ulimit settings are in accordance with mongo's recommendations
152
65
- Changing the settings on the latest versions of [macos can be tricky read here][macos-ulimt] (unless you know you need it you shouldn't have to do the complicated maxproc steps)
153
-
- Prefix the cluster_setup.sh script with `env MONGODB_VERSION=X.Y` to test against a specific version of the server
- When testing different topologies you may need to remove the existing data folder created.
156
-
- To run a single test, use `npm run test -- -g 'test name'`
157
-
- If it's easier you can also isolate tests by adding .only. Example: `it.only(‘cool test’, {})`
158
-
- To test only the unified topology, use `env MONGODB_UNIFIED_TOPOLOGY=1`
66
+
- How can I run just one test?
67
+
- To run a single test, use mocha's grep flag: `npm run test -- -g 'test name'`
68
+
- If it's easier you can also isolate tests by adding `.only` Example: `it.only(‘cool test’, function() {})`
159
69
160
70
### Commit messages
161
71
@@ -188,23 +98,25 @@ These are the commit types we make use of:
188
98
189
99
Below are some conventions that aren't enforced by any of our tooling but we nonetheless do our best to adhere to:
190
100
191
-
-**Disallow `async / await` syntax**
192
-
- There is a measurable overhead to Promise usage vs simple callbacks. To support the broadest of driver usage scenarios we maintain an internal callback api while exposing a surface layer Promise API.
101
+
-**Ensure Promise usage is optional**
102
+
- There is a measurable overhead to Promise usage vs callbacks.
103
+
To support the broadest of driver usage scenarios we maintain an internal callback api while exposing a surface layer Promise API.
193
104
-**Disallow `export default` syntax**
194
105
- For our use case it is best if all imports / exports remain named.
195
106
-**As of 4.0 all code in src is in Typescript**
196
-
- Typescript provides a nice developer experience. As a product of using TS we should be using es6 syntax features whenever possible.
107
+
- Typescript provides a nice developer experience
108
+
As a product of using TS we should be using es6 syntax features whenever possible.
197
109
-**Errors**
198
110
- Error messages should be sentence case, and have no periods at the end.
199
-
- Use built-in error types where possible (not just Error, but TypeError/RangeError), also endeavor to create new Mongo-specific error types (e.g. MongoNetworkError)
111
+
- Use built-in error types where possible (not just `Error`, but `TypeError`/`RangeError`), also endeavor to create new Mongo-specific error types (e.g. `MongoNetworkError`)
200
112
201
113
## Pull Request Process
202
114
203
115
1. Update the README.md or similar documentation with details of changes you
204
116
wish to make, if applicable.
205
-
2. Add any appropriate tests.
206
-
3. Make your code or other changes.
207
-
4. Review guidelines such as [How to write the perfect pull request][github-perfect-pr], thanks!
117
+
1. Add any appropriate tests.
118
+
1. Make your code or other changes.
119
+
1. Review guidelines such as [How to write the perfect pull request][github-perfect-pr], thanks!
208
120
209
121
Take a look at [Github Flow][github-flow] for a more detailed explanation of this process.
210
122
@@ -218,3 +130,4 @@ Take a look at [Github Flow][github-flow] for a more detailed explanation of thi
0 commit comments