@@ -11,10 +11,6 @@ Local testing for Eask is done using the [Jest](https://jestjs.io) testing frame
1111
1212- TODO why jest
1313
14- A custom ` TestContext ` class is used to manage the execution environment for each test suite.
15-
16- - TODO perhaps not relevant here
17-
1814### Running Tests
1915
2016If you have not done so already, run ` npm install --dev `
@@ -36,10 +32,14 @@ For example
3632
3733| Name | Type | Default | Meaning |
3834| :---------------| :-------| ---------| :--------------------------------------------------------------------------------------------------|
39- | ` ALLOW_UNSAFE ` | bool | 0 | Run tests in ` testUnsafe ` blocks. These can ** overwrite** your personal emacs config or settings. |
40- | ` DEBUG ` | bool | 0 | Print full output from commands in test. |
41- | ` EASK_COMMAND ` | path | "eask" | Path to Eask. Usually either ` eask ` or ` ./bin/eask ` (include local changes). |
42- | ` TIMEOUT ` | number | 25000 | Command timeout in ms. Note this is different than Jest's timeout, which should be greater. |
35+ | ` ALLOW_UNSAFE ` | bool* | false | Run tests in ` testUnsafe ` blocks. These can ** overwrite** your personal emacs config or settings. |
36+ | ` DEBUG ` | bool* | false | Print full output from commands in test. |
37+ | ` EASK_COMMAND ` | path | "eask" | Path to Eask. Usually either ` eask ` or ` $PWD/bin/eask ` to use local changes. |
38+ | ` TIMEOUT ` | number | 25000 | Command timeout in ms. Note this is different than Jest's timeout, which should be greater. |
39+
40+ (* ) Node.js handles environment variables as strings. That means that ` DEBUG=0 ` , ` DEBUG=false ` all _ enable_ ` DEBUG ` .
41+ The only setting which disables a boolean flag is null, for example ` DEBUG= `
42+
4343
4444### How to Write a Test
4545
@@ -78,7 +78,7 @@ describe("emacs", () => {
7878});
7979```
8080
81- In Jest, you group related tests using ` describe ` . Tests in the same describe block can share setup/teardown code,
81+ In Jest, you group related tests using ` describe ` . Tests in the same ` describe ` block can share setup/teardown code,
8282can be disabled as a group and are grouped under the same heading in output.
8383
8484` describe ` blocks can be nested within other ` describe ` blocks.
@@ -200,6 +200,7 @@ testUnsafe("global install", async () => {
200200### Common Problems
201201
202202- When using ` runEask() ` , pass only the Eask * arguments* , not the ` eask ` command itself.
203+ - Always ` await ` any expressions that trigger commands.
203204- When using ` expect(...).rejects ` it should be awaited so that the promise rejects before the test completes.
204205- The folder argument to ` TestContext ` should be relative to project root, if it doesn't exist you may get an error ` ENOENT `
205206- If you get an error from Jest reporting open handles, then try using ` afterAll(() => ctx.cleanUp()) `
0 commit comments