Integrate Sublime Text 2 with Karma

2019-04-08 03:52发布

When doing AngularJS development, I have an open terminal window with Karma running (watching file changes). When coding I go back and forth between Sublime Text 2 and the terminal window showing Karma test results.

I find this pretty annoying and I just saw at egghead.io that this guy has Karma results integrated into WebStorm.

Is there anything similar for Sublime Text? I couldn't find any packages related to Karma.

2条回答
Evening l夕情丶
2楼-- · 2019-04-08 04:13

You can use a build system to kind of integrate the two--it opens the ST console and displays the results.

Something like this is what you're looking for:

"build_systems": [
    {
        "name": "Karma Test",
        "cmd": ["karma", "start", "--no-colors"],
        "working_dir": "$project_path"
    }
]
查看更多
爷、活的狠高调
3楼-- · 2019-04-08 04:20

Go to "Tools | Build System | New Build System" and drop in the following code:

{
"path": "/usr/local/share/npm/bin:/usr/local/bin:$PATH",
"working_dir": "${project_path:${folder}}",
"cmd": ["karma", "start"]
}

Can be found here:.

Also this is the best primer for setting up custom text build systems in sublime text that i've seen.

Cheers

查看更多
登录 后发表回答