https://github.com/akosyakov/ts-mocha-debugging
Simple TypeScript setup to debug Mocha tests from VS Code
https://github.com/akosyakov/ts-mocha-debugging
gitpod mocha ts-node typescript vscode
Last synced: 3 months ago
JSON representation
Simple TypeScript setup to debug Mocha tests from VS Code
- Host: GitHub
- URL: https://github.com/akosyakov/ts-mocha-debugging
- Owner: akosyakov
- Created: 2019-01-01T13:25:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T10:25:15.000Z (over 6 years ago)
- Last Synced: 2025-02-28T10:03:30.561Z (4 months ago)
- Topics: gitpod, mocha, ts-node, typescript, vscode
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple TypeScript setup to debug Mocha tests from VS Code
A TypeScript setup to run and debug Mocha tests without extra configuration and runtime overhead of tools like ts-node.
You can try it out with VS Code or in your browser with Gitpod (requires OAuth with GitHub):
[](https://gitpod.io#https://github.com/akosyakov/ts-mocha-debugging)
## Installing
Install `typescript` and `mocha` from cli with:
yarn
*Note: Gitpod auto installs dependencies on the workspace initialization, see [.gitpod.yml](.gitpod.yml)*
## Building
Code and tests can be compiled from cli with:
yarn watch
*Note: Gitpod auto starts watching on each workspace startup, see [.gitpod.yml](.gitpod.yml)*
## Running tests
All tests can be run from cli with:
yarn test
## Debugging tests
An individual ts spec file can be debugged in VS Code or Gitpod with `Mocha Tests` configuration:
- select a ts spec file, i.e. [repo.spec.ts](src/repo.spec.ts);
- add a breakpoint;
- press `F5` to run tests in the selected file.[tsc is configured](tsconfig.json) to compile to `lib` folder and produce source maps.
[Mocha Test](.vscode/launch.json) configuration looks up source maps from the `lib` folder via `outFiles` property,
and executes tests from all files matching `**/${fileBasenameNoExtension}.js`,
e.g. for `src/repo.spec.ts` files matching `**/repo.spec.js` are included.