@@ -15,13 +15,82 @@ relevant project on github, and then [create a pull request](
1515https://help.github.com/articles/using-pull-requests/ ) to ask us to pull
1616your changes into our repo.
1717
18- We use [ Buildkite ] ( https://buildkite.com/matrix-dot-org/mjolnir ) for continuous
19- integration. If your change breaks the build, this will be shown in GitHub, so
18+ We use Github Actions for continuous integration.
19+ If your change breaks the build, this will be shown in GitHub, so
2020please keep an eye on the pull request for feedback.
2121
22+ ## Development
23+
2224To run unit tests in a local development environment, you can use ` yarn test `
2325and ` yarn lint ` .
2426
27+ ### mx-tester
28+
29+ For integration testing, and spinning up a local synapse we use
30+ [ mx-tester] ( https://github.com/matrix-org/mx-tester ) .
31+ While not required for basic changes, it is strongly recommended
32+ to use mx-tester or have the ability to spin up your own
33+ development Synapse to develop mjolnir interactively.
34+
35+ To install ` mx-tester ` you will need the [ rust toolchain] ( https://rustup.rs/ )
36+ and Docker. You should refer to your linux distribution's documentation
37+ for installing both, and do not naively follow the instructions
38+ from rustup.rs without doing so first.
39+ Then you will be able to install ` mx-tester ` with ` cargo install mx-tester ` .
40+ Updating mx-tester can be done by installing ` cargo install cargo-update `
41+ and using ` cargo install-update mx-tester ` , though you may skip
42+ this step until it is necessary to update ` mx-tester ` .
43+
44+ #### Usage
45+
46+ You can then start a local synapse using ` mx-tester build ` ,
47+ followed by ` mx-tester up ` . You can then use ` up ` , ` down ` as many
48+ times as you like.
49+ If for some reason you need to get a clean Synapse database,
50+ you can just use ` mx-tester down build ` .
51+
52+ ### Debugging
53+
54+ For debugging mx-tester it is recommended to use Visual Studio Code.
55+ If you open the project in visual studio code, press ` F1 ` ,
56+ type ` Debug: JavaScript Debug Terminal `
57+ (see the [ documentation] ( https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_javascript-debug-terminal ) ),
58+ and you should get a terminal from which node will always connect to
59+ Visual Studio Code.
60+
61+ The following sections assume that a Synapse is running
62+ and ` config/harness.yaml ` has been configured to connect to it.
63+ If you are using ` mx-tester ` and you use ` mx-tester up ` , this will
64+ already be the case.
65+
66+ #### Debugging and reproducing an issue
67+
68+ If you need to debug an issue that is occurring through use in matrix,
69+ say the unban command has stopped working, you can launch
70+ mjolnir from the JavaScript Debug Terminal using ` yarn test:manual ` .
71+ This will launch mjolnir using the config found in ` config/harness.yaml ` .
72+ You can now open https://app.element.io , change the server to ` localhost:8081 ` ,
73+ and then create an account.
74+ From here you can join the room ` #moderators:localhost:9999 ` (you will also be
75+ able to find it in the rooms directory) and interact with mjolnir.
76+
77+ It is recommended to set breakpoints in the editor while interacting
78+ and switch the tab to "DEBUG CONSOLE" (within Visual Studio Code)
79+ to evaluate arbitrary expressions in the currently paused context (when
80+ a breakpoint has been hit).
81+
82+ #### Debugging an integration test
83+
84+ To debug the integration test suite from the JavaScript Debug Terminal,
85+ you can start them using ` yarn test:integration ` .
86+ However, more often than not there is a specific section of
87+ code you will be working on that has specific tests. Running
88+ the entire suite is therefore unnecessary.
89+ To run a specific test from the JavaScript Debug Terminal,
90+ you can use the script ` yarn test:integration:single test/integration/banListTest.ts ` ,
91+ where ` test/integration/banListTest.ts ` is the name of the integration test you
92+ want to run.
93+
2594## Code style
2695
2796All Matrix projects have a well-defined code-style - and sometimes we've even
0 commit comments