Giter Site home page Giter Site logo

janne252 / karma-webpack-typescript-coverage-vscode-debug Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 53 KB

A minimal unit testing setup with webpack, TypeScript, coverage, and VS Code debugging.

JavaScript 87.75% TypeScript 12.25%
karma karma-jasmine karma-webpack coverage typescript unit-testing debugging vs-code

karma-webpack-typescript-coverage-vscode-debug's Introduction

Karma, Jasmine, Webpack, TypeScript, Coverage, VS Code Debug

This is a sample project that allows:

  • Running TypeScript-based unit tests
  • Measuring code coverage
  • Using breakpoints in VS Code to debug
    • The two experimental launch config options of vscode-chrome-debug, breakOnLoad and breakOnLoadStrategy, (see https://github.com/microsoft/vscode-chrome-debug#other-optional-launch-config-fields) appear to allow pausing on a breakpoint on the first run of the tests. Obviously works better if you start the debugging process first and then start the unit tests. The default timeout is 30 seconds, which may not be enough if you're doing a "cold start", meaning that you haven't ran the unit tests in a while.
    • Clicking the "Restart" action of the floating debugging panel will re-trigger execution of the unit tests, similar to saving a file that is referenced in one of the loaded unit test files

Caveats

  • Code coverage may cause problems with breakpoint mappings (e.g. setting a breakpoint on line 3 might actually pause the execution on like 2)
    • Use npm run debug when intending to debug the unit tets.
    • Use npm run test when intending to generally execute the unit tests and measure code coverage
      • You may still set breakpoints and try debugging the unit tests but the experience may be degraded as explained above

karma-webpack-typescript-coverage-vscode-debug's People

Contributors

janne252 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.