karma README

The project's README from github.com/karma-runner/karma. As one markdown file: README.md.

Karma

js-standard-style npm version npm downloads

Code Climate PRs Welcome Dependency Status devDependency Status semantic-release

A simple tool that allows you to execute JavaScript code in multiple real browsers.

The main purpose of Karma is to make your test-driven development easy, fast, and fun.

Karma is deprecated and is not accepting new features or general bug fixes.

The web testing space has evolved significantly in the 10+ years since Karma's creation. The web landscape looks very different today and new patterns and tools have emerged in the ecosystem. New test runners offer more performant alternatives, and Karma no longer provides clear unique value.

Based on the current state of the web testing ecosystem, we have made the hard decision to deprecate Karma.

We know Karma is used particularly commonly in the Angular ecosystem, so Angular is adding Jest and Web Test Runner support to provide a migration path off of Karma. See the Angular blog for more details.

Critical security issues in Karma will still be triaged and fixed as necessary. This will continue until 12 months after Angular CLI's Web Test Runner support is marked stable.

For those outside Angular looking to migrate off Karma, both Web Test Runner and jasmine-browser-runner provide browser-based unit testing solutions which can be used as a direct alternative. Jest and Vitest also provide Node-based alternatives.

It has been incredible to see Karma's impact on the web testing ecosystem and we greatly appreciate the support of everyone who contributed to an awesome community. Keep testing. ✅

Help and Support

For questions and support please use the mailing list or Gitter. The issue tracker is for bug reports and feature discussions only.

When should I use Karma?

But I still want to use _insert testing library_

Karma is not a testing framework, nor an assertion library. Karma just launches an HTTP server, and generates the test runner HTML file you probably already know from your favourite testing framework. So for testing purposes you can use pretty much anything you like. There are already plugins for most of the common testing frameworks:

If you can't find an adapter for your favourite framework, don't worry and write your own. It's not that hard and we are here to help.

Which Browsers can I use?

All the major browsers are supported, if you want to know more see the browsers page.

Troubleshooting

See FAQ.

I want to use it. Where do I sign?

You don't need to sign anything but here are some resources to help you to get started...

Obligatory Screencast.

Every serious project has a screencast, so here is ours. Just click here and let the show begin.

Installation.

See installation.

Using it.

See configuration.

This is so great. I want to help.

Please, see contributing.

Why did you create this?

Throughout the development of AngularJS, we've been using JSTD for testing. I really think that JSTD is a great idea. Unfortunately, we had many problems with JSTD, so we decided to write our own test runner based on the same idea. We wanted a simple tool just for executing JavaScript tests that is both stable and fast. That's why we use the awesome Socket.io library and Node.js.

My boss wants a license. So where is it?

MIT License

karma (karma-runner/karma)

Searching Database…

12K ·GitHub
这是什么?Karma 是一个 JavaScript 测试运行器,可以在多个真实的(而非模拟的)浏览器中执行你的代码。它的既定目标是让测试驱动开发变得简单、快速、有趣。
那 Karma 本身是不是像 Jasmine 那样的测试框架?不是——Karma 既不是测试框架,也不是断言库。它会启动一个 HTTP 服务器并生成测试运行器的 HTML 页面,而你的测试则来自你自选的框架:Jasmine、Mocha 和 QUnit 都有适配器,你也可以自己编写。
在我的项目里要怎么安装配置它?按照 README 中的安装指南把 Karma 添加到你的项目里,然后按照配置文档的说明创建一个配置文件。之后你就可以在终端里运行测试了。
在这之前我需要先装点什么吗——比如 Node?需要——Karma 本身运行在 Node.js 上(它基于 Node 和 Socket.io 构建),所以必须安装 Node;该仓库要求 Node 10 或更高版本。
它现在还在积极维护吗?现在采用会不会有风险?有风险——Karma 已被弃用:不再接受新功能或一般性的 bug 修复,只有关键的安全问题才会继续修复。这种状态会一直持续到 Angular CLI 的 Web Test Runner 支持被标记为稳定之后的 12 个月。
我的测试会在哪些浏览器里运行?所有主流浏览器都支持,桌面端和移动端都包括——让同一套测试在多个真实浏览器(桌面、移动、平板)上运行,正是 Karma 的核心使用场景之一。
现在我应该用什么来替代 Karma?对于必须在真实浏览器中运行的测试,Web Test Runner 和 jasmine-browser-runner 被列为直接替代品;基于 Node 的测试则推荐 Jest 和 Vitest。Angular 正在添加对 Jest 和 Web Test Runner 的支持,作为从 Karma 迁移的官方路径。
Karma 开箱即用能给我带来什么?它可以在开发过程中本地运行你的测试套件,并在每次保存文件时自动运行,也可以在 CI 服务器上运行,还能跨多个桌面、移动和平板浏览器执行;它还可以通过 Istanbul 生成覆盖率报告,并支持用 RequireJS 加载你的源文件。
作者为什么要做这个工具?在测试 AngularJS 时,作者使用了 JSTD,虽然喜欢这个思路,但遇到了很多问题,于是他决定自己写一个运行器:一个专门用来执行 JavaScript 测试的简单工具——稳定且快速——基于 Node.js 和 Socket.io 构建。
What are similar projects?ava, jasmine, vitest, angular-seed, mocha, pest, jest, pollyjs
Size
10.3 MB
Stars
12K
Age
15y
Commits · 90 Days