小编use*_*715的帖子

Gitk下面板无法调整大小

在gitk中有两个面板,顶部面板主要显示提交列表,底部面板显示此提交中的更改.不知怎的,从本周开始,我无法调整这两个面板的高度,比如让它们中的一个更大/更小.知道为什么吗?

git gitk

25
推荐指数
3
解决办法
1782
查看次数

在mocha中运行supertest时如何获得实际的服务器错误?

我有使用supertest和mocha的代码:

import request from 'supertest';

//....

var newGame;
describe('Creating game', function() {
  beforeEach(function(done) {
    request(app)
      .post('/api/games')
      .send({
        owner: 'Mr. X',
      })
      .expect(201)
      .expect('Content-Type', /json/)
      .end((err, res) => {
        if (err) {
          return done(err);
        }
        newGame = res.body;
        done();
      });
  });    

  describe('the created game', function() {

    it('should name the specified owner', function() {
      newGame.owner.should.equal('Mr. X');
    });

   ...
  })
});
Run Code Online (Sandbox Code Playgroud)

当服务器代码抛出一些异常(例如访问未定义对象的属性)时,我得到了这个堆栈跟踪

Error: expected 201 "Created", got 500 "Internal Server Error"
  at Test._assertStatus (D:\Codes\theApp\node_modules\supertest\lib\test.js:232:12)
  at Test._assertFunction (D:\Codes\theApp\node_modules\supertest\lib\test.js:247:11)
  at Test.assert (D:\Codes\theApp\node_modules\supertest\lib\test.js:148:18)
  at Server.assert (D:\Codes\theApp\node_modules\supertest\lib\test.js:127:12) …
Run Code Online (Sandbox Code Playgroud)

mocha.js node.js supertest

12
推荐指数
1
解决办法
3543
查看次数

Parallel.ForEach与BlockingCollection集成时停滞不前

我根据这个问题中的代码采用了并行/消费者的实现

class ParallelConsumer<T> : IDisposable
{
    private readonly int _maxParallel;
    private readonly Action<T> _action;
    private readonly TaskFactory _factory = new TaskFactory();
    private CancellationTokenSource _tokenSource;
    private readonly BlockingCollection<T> _entries = new BlockingCollection<T>();
    private Task _task;

    public ParallelConsumer(int maxParallel, Action<T> action)
    {
        _maxParallel = maxParallel;
        _action = action;
    }

    public void Start()
    {
        try
        {
            _tokenSource = new CancellationTokenSource();
            _task = _factory.StartNew(
                () =>
                {
                    Parallel.ForEach(
                        _entries.GetConsumingEnumerable(),
                        new ParallelOptions { MaxDegreeOfParallelism = _maxParallel, CancellationToken = _tokenSource.Token },
                        (item, loopState) => …
Run Code Online (Sandbox Code Playgroud)

.net c# parallel-processing task-parallel-library

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

这种模式是如何工作的:'test/e2e/**/*.spec.js'?

我在配置文件中看到了用于量角器的这种模式.

specs: [
  'test/e2e/**/*.spec.js'
]
Run Code Online (Sandbox Code Playgroud)

意思是它意味着" test/e2e中的所有文件".这是什么样的模式?我认为这不是正则表达式,因为那些未转义的斜杠.特别是,为什么**在中间,而不仅仅是test/e2e/*.spec.js

我尝试使用搜索引擎,但没有找到任何有用的可能因为星号在搜索引擎中不能很好地工作.

javascript filepath node.js protractor

5
推荐指数
2
解决办法
847
查看次数

如何获得值为true的所有名称?

在javascript中,假设我有这个:

var foo = { a: true, b: false, c: true };
Run Code Online (Sandbox Code Playgroud)

如何获取其值为true的所有名称?在上面的例子中,这段代码将返回['a', 'c']

javascript

0
推荐指数
1
解决办法
38
查看次数