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
Copy file name to clipboardExpand all lines: DEVELOPER.md
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,11 +89,11 @@ You can copy this tar into your project and run `npm install ./typeorm-x.x.x.tgz
89
89
90
90
## Running Tests Locally
91
91
92
-
It would be greatly appreciated if PRs that change code come with appropriate tests.
92
+
It is greatly appreciated if PRs that change code come with appropriate tests.
93
93
94
-
To create a test for a specific issue opened on GitHub, create a file: `test/github-issues/<num>/issue-<num>.ts` where
95
-
`<num>` is the corresponding GitHub issue. For example, if you were creating a PR to fix github issue #363, you'd
96
-
create `test/github-issues/363/issue-363.ts`.
94
+
To create a new test, check the [relevant functional tests](https://github.com/typeorm/typeorm/tree/master/test/functional). Depending on the test, you may need to create a new test file or modify an existing one.
95
+
96
+
If the test is for a specific regression or issue opened on GitHub, add a comment to the tests mentioning the issue number.
97
97
98
98
Most tests will benefit from using this template as a starting point:
// optional: test fix for issue https://github.com/typeorm/typeorm/issues/<issue-number>
117
118
it("should <put a detailed description of what it should do here>", () =>Promise.all(dataSources.map(asyncdataSource=> {
118
-
119
119
// tests go here
120
-
121
120
})));
122
121
123
-
// you can add additional tests if needed
124
-
122
+
// you can add additional tests if needed
125
123
});
126
124
```
127
125
128
-
If you place entities in `./entity/<entity-name>.ts` relative to your `issue-<num>.ts` file,
126
+
If you place entities in `./entity/<entity-name>.ts` relative to your test file,
129
127
they will automatically be loaded.
130
128
131
129
To run the tests, setup your environment configuration by copying `ormconfig.sample.json` into `ormconfig.json` and replacing parameters with your own. The tests will be run for each database that is defined in that file. If you're working on something that's not database specific and you want to speed things up, you can pick which objects in the file make sense for you to keep.
Alternatively, you can use the `--grep` flag to pass a regex to `mocha`. Only the tests that have `describe`/`it` statements that match the regex will be run. For example:
150
148
151
149
```shell
152
-
npm run test -- --grep "github issues > #363"
150
+
npm run test -- --grep "your test name"
153
151
```
154
152
155
153
### Faster developer cycle for editing code and running tests
0 commit comments