Mocha测试不在gitlab runner中执行

时间:2018-05-28 15:38:24

标签: javascript docker mocha gitlab gitlab-ci

当我打电话

"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha --require babel-core/register test/**/*test.js --reporter spec"

在本地我执行所有测试,但是如果我通过带有docker executor的Gitlab-runner启动它。只描述块被执行。 之前不会被执行。

测试代码:

describe('\'users\' service', () => {
  before(() => getApp().then((data) => {
    app = data;
    console.log('not logged here');
  }).catch(err => console.log(err)));
  console.log('logged here');  
  it('registered the service', () => {
    assert.ok(app.service('users'), 'Registered the service');
    console.log('not logged here');  
  });
  console.log('logged here');  
});

Gitlab配置:

image: node:8.11.2

cache:
  paths:
    - node_modules/

test:
  stage: test
  environment: Test
  script:
    - cd app/myccio
    - npm i -g mocha
    - npm i -g chai
    - yarn install --ignore-engines
    - yarn run test
  coverage:
    '/Statements.*?(\d+(?:\.\d+)?)%/'

gitlab-runner上的错误没有说什么,只退出代码1。

0 个答案:

没有答案