Heads Up! You're viewing the docs for v6.1, an old version of Karma. v6.4 is the newest.

Making Changes

If you are thinking about making Karma better, or you just want to hack on it, that’s great! Here are some tips on how to set up a Karma workspace and how to send a good pull request. Please note we enforce commit message conventions.

Setting up the Workspace #

  • Make sure you have a GitHub account.
  • Fork the repository on GitHub.
  • Clone your fork
    $ git clone https://github.com/<your-username>/karma.git
    $ cd karma
    
  • Install for development. Use a recent npm version, ignore peerdep warnings
    $ npm install
    
    $ npm run init
    # or if you're on Windows
    $ npm run init:windows
    

Testing and Building #

  • Run the tests via:

    $ npm test
    # or you can run test suits individually
    $ npm run test:unit
    $ npm run test:e2e
    $ npm run test:client
    
  • Lint the code via:

    $ npm run lint
    # or you can also apply auto-fixes where possible
    $ npm run lint:fix
    
  • Build the client code via:

    $ npm run build
    # or use the watch mode
    $ npm run build:watch
    

Changing the Code #

Checkout a new branch and name it accordingly to what you intend to do:

  • Features get the prefix feature-.
  • Bug fixes get the prefix fix-.
  • Improvements to the documentation get the prefix docs-.
    $ git checkout -b <branch_name>
    

Open your favorite editor, make some changes, run the tests, change the code, run the tests, change the code, run the tests, etc.

Sending a Pull Request #

  • Commit your changes (please follow our commit message conventions):
    $ git commit -m "..."
    
  • Push to your github repo:
    $ git push origin <branch_name>
    
  • Go to the GitHub page and click "Open a Pull request".
  • Write a good description of the change.

After sending a pull request, other developers will review and discuss your change. Please address all the comments. Once everything is all right, one of the maintainers will merge your changes in.

Contributor License Agreement #

Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code changes to be accepted, the CLA must be signed. It's a quick process, we promise!

Additional Resources #