首页 > 解决方案 > 业力并行 npm 包不适用于圆形 CI

问题描述

我正在使用 karma-parallel npm 包在 Angular 应用程序上运行 karma 单元测试。它在我的本地机器上就像一个魅力,并大大减少了构建时间。但是,当我在 Circle CI 上运行单元测试用例时,它似乎失败了。

我仍在查看 Circle CI 是否支持 karma-parallel 但我还没有找到任何东西

My Karma.conf.js file looks like this:

    module.exports = function (config) {
       config.set({
          basePath: '',
          frameworks: ['parallel', 'jasmine', '@angular-devkit/build-angular'],
          plugins: [
             require('karma-parallel'),
             require('karma-jasmine'),
             require('karma-chrome-launcher'),
             require('karma-spec-reporter'),
             require('karma-jasmine-html-reporter'),
             require('karma-coverage-istanbul-reporter'),
             require('@angular-devkit/build-angular/plugins/karma')
          ],
          parallelOptions: {
             executors: 2,
             shardStrategy: 'round-robin' 

         })};

Expected Behavior: The unit tests should run in parallel on the circle CI as they do on my local machine.

Actual Behavior: The unit test fails on the circle CI and I get the following error:

Error: spawn ENOMEM
    at ChildProcess.spawn (internal/child_process.js:366:11)
    at spawn (child_process.js:538:9)
    at Object.fork (child_process.js:113:10)
    at fork (/home/circleci/project/node_modules/worker-farm/lib/fork.js:17:36)
    at Farm.startChild (/home/circleci/project/node_modules/worker-farm/lib/farm.js:107:16)
    at Farm.processQueue (/home/circleci/project/node_modules/worker-farm/lib/farm.js:288:10)
    at Farm.<anonymous> (/home/circleci/project/node_modules/worker-farm/lib/farm.js:98:21)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-app@0.0.0 build: `node --max_old_space_size=8096 node_modules/@angular/cli/bin/ng build --prod --source-map=false --watch=false "-c=qa"`
npm ERR! Exit status 1

标签: angularunit-testingkarma-runnercircleci

解决方案


推荐阅读