项目介绍

developit/karmatic 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,目前获得 1.2k 个 Star、30 次 Fork。

仓库全名
developit/karmatic
Star 数
1.2k
Fork 数
30
未关闭 Issue
10

README 摘要

Zero-config browser tests powered by [Karma] & [Puppeteer], with automatic [Rollup] & [Webpack] support. Think of it like Jest for cross-browser testing - it even uses the same expect syntax. Why do I want this? Karma, Rollup/Webpack and Jasmine are all great. They're all also quite powerful and each highly configurable. When creating and maintaining small modules, duplication of these configurations and…

完整内容见 GitHub 原始 README 或本页 。

常见问题

karmatic 用什么语言开发?

主要使用 JavaScript 编写,目前有 1.2k 个 Star。

如何获取 karmatic 的源码?

可以直接克隆仓库:git clone https://github.com/developit/karmatic.git,默认分支为 master;安装与运行步骤见仓库 README。

karmatic 最近还在维护吗?

仓库最近一次更新为 2022年5月24日,当前有 10 个未关闭 Issue;Star 数为 1.2k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

🦑 Easy automatic (headless) browser testing with Jest's API, but powered by Karma & Webpack.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
1234
价值分
705
活跃状态
活跃

语言占比

JavaScript

Release

README

Karmatic npm travis

Zero-config browser tests powered by Karma & Puppeteer, with automatic Rollup & Webpack support.

Think of it like Jest for cross-browser testing - it even uses the same expect syntax.

Why do I want this?

Karma, Rollup/Webpack and Jasmine are all great. They’re all also quite powerful and each highly configurable. When creating and maintaining small modules, duplication of these configurations and dependencies is cumbersome.

Karmatic is a zero-configuration wrapper around these tools with intelligent defaults, configuration auto-detection, and optimizations most configurations don’t include.

Most importantly, Karmatic provides a (headless) browser test harness in a single dependency.

Installation

npm i -D karmatic

… then add a test script to your package.json:

{
    "scripts": {
    	"test": "karmatic"
    }
}

… now you can run your tests using npm t. Here’s a minimal example repo.

If you have webpack set up in your project, it will be detected and your webpack.config.js will be used. Otherwise, Rollup is used to bundle tests and any rollup.config.js will be used if present.

Test File Patterns

By default, Karmatic will find tests in any files ending in .test.js or _test.js. You can change this to any minimatch pattern (note the quotes to avoid shell expansion):

karmatic '**/*Spec.jsx?'

Options

--chromeDataDir <filename>

Filename to be used to save Chrome preferences between test runs. Useful for debugging tests. It is recommended to also add this filename to .gitignore.

Example:

karmatic --chromeDataDir .chrome

Usage

Usage
    $ karmatic <command> [options]

Available Commands
    run      Run tests once and exit
    watch    Run tests on any change
    debug    Open a headful Puppeteer instance for debugging your tests

For more info, run any command with the `--help` flag
    $ karmatic run --help
    $ karmatic watch --help

Options
    -v, --version    Displays current version
    --files          Minimatch pattern for test files
    --headless       Run using Chrome Headless  (default true)
    --coverage       Report code coverage of tests  (default true)
    -h, --help       Displays this message

To disable any option that defaults to true, pass false to the option: --headless false or --coverage false.

NOTE: The debug option overrides the default value of the --headless and --coverage option to be false. This option will also open up the local Puppeteer installation of Chrome, not your globally installed one. If you’d like to debug your tests using your your own instance of Chrome (or any other browser), copy the URL from the puppeteer window into your favorite browser.

FAQ

Q: Is there an FAQ?**

Yes.

Projects Using Karmatic

Karmatic is pretty new! Here are some projects that have switched to it you may use as a reference:

License

MIT © developit

评论

暂无评论