Pantomjs not starting while running ng test in DockerFile

70 views Asked by At
`17:09:57 12 05 2023 11:39:57.559:INFO [karma]: Karma v1.7.1 server started at http://localhost:9876/
17:09:57 12 05 2023 11:39:57.560:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
17:09:57 12 05 2023 11:39:57.568:INFO [launcher]: Starting browser PhantomJS
17:09:58 12 05 2023 11:39:57.997:ERROR [phantomjs.launcher]: Error executing phantom at /app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
17:09:58 Error: spawn /app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT
17:09:58     at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
17:09:58     at onErrorNT (internal/child_process.js:465:16)
17:09:58     at processTicksAndRejections (internal/process/task_queues.js:80:21)
17:09:58 
17:09:58 12 05 2023 11:39:57.999:ERROR [launcher]: Cannot start PhantomJS
17:09:58    Error executing phantom at /app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
17:09:58 Error: spawn /app/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs ENOENT
17:09:58     at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
17:09:58     at onErrorNT (internal/child_process.js:465:16)
17:09:58     at processTicksAndRejections (internal/process/task_queues.js:80:21)`

I tried setting ENV PHANTOMJS_BIN=./node_modules/phantomjs-prebuilt/bin/phantomjs ENV PHANTOMJS_HOME=./node_modules/phantomjs-prebuilt

in DockerFile

I tried setting

ENV PHANTOMJS_BIN=./node_modules/phantomjs-prebuilt/bin/phantomjs ENV PHANTOMJS_HOME=./node_modules/phantomjs-prebuilt

karma.conf.js :

`module.exports = function (config) {   config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      { pattern: './src/test.ts', watched: false },
      { pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css', included: true, watched: true },
    ],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime:{
      'text/x-typescript':['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['PhantomJS'],
    singleRun: false   }); };

test command : ng test --single-run=true --browsers PhantomJS --watch=false --code-coverage=true --reporters=coverage-istanbul

0

There are 0 answers