小编sak*_*_to的帖子

是否有适用于ES6的代码复杂性计量工具?

我的项目是ES6(webpack + babel).柏拉图是伟大的,但不与ES6工作还没有.我看了一下escomplex和一系列相关软件包,但看起来作者不再维护它了,似乎它不支持ES6.

我正在使用ESLint复杂性规则至少警告我是否存在问题(它设置为在6处发出警告),但它与漂亮的报告不同.

有什么建议?

code-complexity ecmascript-6 plato webpack babeljs

10
推荐指数
1
解决办法
2075
查看次数

Karma无法捕获PhantomJS

我们已经建立了一个运行Karma的Jenkins CI服务器,目标是PhantomJS.我们正在通过Grunt运行我们的测试.Jenkins,Grunt和Phantom都运行正常,而Karma似乎开始很好,但是Karma无法捕获Phantom.我们的脚本在本地运行(OSX)就好了.通过bash或Jenkins运行相同的错误:

Running "karma:jenkins-unit" (karma) task
[2013-07-03 11:03:12.168] [WARN] config - urlRoot normalized to "/__karma/"
DEBUG [reporter]: Using reporter "dots".
DEBUG [reporter]: Using reporter "junit".
DEBUG [reporter]: Using reporter "coverage".
INFO [karma]: Karma server started at http://localhost:8084/__karma/
INFO [launcher]: Starting browser PhantomJS
DEBUG [launcher]: Creating temp dir at /tmp/testacular-7720703
DEBUG [launcher]: phantomjs /tmp/testacular-7720703/capture.js
INFO [karma]: To run via this server, use "karma run --runner-port 9104"
...
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
DEBUG [launcher]: Process PhantomJS …
Run Code Online (Sandbox Code Playgroud)

centos node.js phantomjs socket-timeout-exception karma-runner

9
推荐指数
1
解决办法
6409
查看次数

使用sinon进行存根时ava异步测试的问题

我有几个测试,我想在我的一个依赖项的块.then.catch块上运行.

import test from 'ava';
import sinon from 'sinon';

// Fake dependency code - this would be imported
const myDependency = {
    someMethod: () => {}
};

// Fake production code - this would be imported
function someCode() {
    return myDependency.someMethod()
        .then((response) => {
            return response;
        })
        .catch((error) => {
            throw error;
        });
}

// Test code

let sandbox;

test.beforeEach(() => {
    sandbox = sinon.sandbox.create();
});

test.afterEach.always(() => {
    sandbox.restore();
});

test('First async test', async (t) …
Run Code Online (Sandbox Code Playgroud)

async-await sinon ava

6
推荐指数
1
解决办法
4794
查看次数

gulp-watch,gulp-watch-less不要开火

按照记录在案的例子后,我无法通过gulp-watchgulp-watch-less来解决问题.我最初的问题是lazypipe(这里没有显示),但在我看来,我在使用插件的方式上做错了.这是我愚蠢的代码仍然无法正常工作.

请注意,我尝试使用普通的gulp-watch,它表现出完全相同的问题:它不会在更改时触发后续管道.如果出现问题,我会在这里附上信息.

这是我的gulpfile.

var debug = require ( 'gulp-debug' );
var gulp = require ( 'gulp' );
var less = require ( 'gulp-less' );
var watchLess = require ( 'gulp-watch-less' ); 

gulp.task ( 'dev-watch', function () {
  // main.less just imports child less files
  gulp.src ( './app/styles/less/main.less' )
    .pipe ( watchLess ( './app/styles/less/main.less' ) )
    .pipe ( debug () );
    .pipe ( less () )
    .pipe ( gulp.dest ( './app/styles' ) )
  ;
});
Run Code Online (Sandbox Code Playgroud)

当我启动任务时,它会执行并完美地生成预期的文件.我看到调试输出流信息也很好.

当我更改文件时,我看到watchLess正在接受更改: …

gulp gulp-less gulp-watch

5
推荐指数
1
解决办法
1476
查看次数