Skip to content

Commit

Permalink
Add lldb debug integration tests config, upgrade mocha to prevent chi…
Browse files Browse the repository at this point in the history
…ld process being spawned
  • Loading branch information
Tom Duncalf committed Nov 17, 2021
1 parent 8bc792c commit b7beccc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@
],
"cwd": "${workspaceFolder}/tests"
},
{
"type": "lldb",
"request": "launch",
"name": "LLDB Debug Integration Tests",
"program": "node",
"args": [
"--expose_gc",
"node_modules/mocha/bin/mocha",
"--require",
"ts-node/register/transpile-only",
"--require",
"src/utils/inject-node-globals.ts",
"src/index.ts",
"--grep",
"${input:integrationTestFilter}"
],
"cwd": "${workspaceFolder}/integration-tests/tests"
}
],
"compounds": [
{
Expand All @@ -112,6 +130,12 @@
"type": "promptString",
"default": ".",
"description": "Filtering used to limit what tests are run"
},
{
"id": "integrationTestFilter",
"type": "promptString",
"default": "",
"description": "Filtering used to limit what tests are run"
}
]
}
12 changes: 10 additions & 2 deletions integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ npm start -- --grep "Realm#constructor"
```

It's advised to use two open terminals:
* One running `npm start` (from the `./tests` directory) to continuously run the integration tests when code change.
* Another occasionally running `npm run build` (from the project root directory) when changes are made to the C++ source-code of Realm JS

- One running `npm start` (from the `./tests` directory) to continuously run the integration tests when code change.
- Another occasionally running `npm run build` (from the project root directory) when changes are made to the C++ source-code of Realm JS

The tests will re-run when the test suite changes and it has Realm JS installed as a symbolic link and will therefore run the latest Realm JS javascript code when the tests run. To reload the native module, you will however need to kill and restart the process running in the second terminal.

Expand All @@ -71,11 +72,18 @@ When running the environments individually the test suite's TypeScript is not au
npm run build:watch --prefix tests
```

## Running tests with a C++ debugger attached

In order to debug the tests with `lldb` attached to debug C++, you can use the VS Code launch configuration `LLDB Debug Integration Tests`.

This bypasses the usual startup script (as this spawns a child process for the tests, which stops `lldb` working), so you need to have the app importer running separately when doing this: `npm run app-importer` from the `integration-tests/tests` directory.

---

## Maintaining the tests

This directory of the repository contains three sub-directories:

- [./tests](./tests): A suite of tests which are supposed to pass in all defined environments.
- [./environments](./environments): A number of environments in which the tests are supposed pass:
- [Node.js](./environments/node/README.md)
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
"@types/mocha": "^5.2.6",
"concurrently": "^6.0.2",
"fs-extra": "^7.0.1",
"mocha": "^5.2.0",
"mocha": "^9.1.3",
"node-fetch": "^2.6.1",
"realm": "*",
"realm-app-importer": "*",
"ts-mocha": "^6.0.0",
"typescript": "^4.2.4"
},
"dependencies": {
"chai": "^4.2.0",
"realm-network-transport": "^0.7.0"
"realm-network-transport": "^0.7.0",
"ts-node": "^10.4.0"
},
"files": [
"/dist"
]
}
}

0 comments on commit b7beccc

Please sign in to comment.