PhantomJS/Chrome fails in Karma test with “Zonenat”/“Script error” in an Angular 6 project












0















Hi people of the StackOverflow,



I am stuck! My ng test fails, although ng serve builds and compiles this Angular 6 project with no issues. The error I am getting is the following:



Karma fails



Additionally, immediately after that Chrome fails, just as so:



enter image description here



I have little to no understanding of what's happening, but this issue prevents the successful deploy, as the build-street fails.



As a big noob I am furiously going in a loop of trying to apply solutions that closely resembles my issue, but with no avail. That is why I am asking you guys for help! I've tried doing PhantomJS does not work with Karma in Angular2 project; put import 'zone.js/dist/zone' from polyfills.ts in the top of the file; updating PhantomJS and what not.



My karma.conf.js is as follows:



module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
/*...*/
browsers: ['Chrome', 'PhantomJS'],
singleRun: true
});
};


Don't know if it'll help but my package.json looks like this:



 {
"name": "isms-frontend",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prepare": "patch-package"
},
"private": true,
"dependencies": {
"@angular/animations": "6.1.8",
"@angular/cdk": "^6.4.7",
"@angular/common": "6.1.8",
"@angular/compiler": "6.1.8",
"@angular/core": "6.1.8",
"@angular/forms": "6.1.8",
"@angular/http": "6.1.8",
"@angular/material": "^6.4.7",
"@angular/platform-browser": "6.1.8",
"@angular/platform-browser-dynamic": "6.1.8",
"@angular/router": "6.1.8",
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"intl": "^1.2.5",
"ngx-window-core": "^1.0.84",
"rxjs": "6.3.2",
"rxjs-compat": "6.3.2",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
"@angular-devkit/build-ng-packagr": "~0.8.0",
"@angular/cli": "~6.2.1",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
"ng-packagr": "^4.1.0",
"phantomjs-prebuilt": "^2.1.16",
"patch-package": "^5.1.1",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tsickle": ">=0.29.0",
"tslib": "^1.9.0",
"tslint": "~5.11.0",
"typescript": "~2.9.2"
}
}


Please let me know if any more information can help resolve this issue. Thanks in advance for your time!










share|improve this question





























    0















    Hi people of the StackOverflow,



    I am stuck! My ng test fails, although ng serve builds and compiles this Angular 6 project with no issues. The error I am getting is the following:



    Karma fails



    Additionally, immediately after that Chrome fails, just as so:



    enter image description here



    I have little to no understanding of what's happening, but this issue prevents the successful deploy, as the build-street fails.



    As a big noob I am furiously going in a loop of trying to apply solutions that closely resembles my issue, but with no avail. That is why I am asking you guys for help! I've tried doing PhantomJS does not work with Karma in Angular2 project; put import 'zone.js/dist/zone' from polyfills.ts in the top of the file; updating PhantomJS and what not.



    My karma.conf.js is as follows:



    module.exports = function (config) {
    config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
    require('karma-jasmine'),
    require('karma-chrome-launcher'),
    require('karma-phantomjs-launcher'),
    require('karma-jasmine-html-reporter'),
    require('karma-coverage-istanbul-reporter'),
    require('@angular-devkit/build-angular/plugins/karma')
    ],
    /*...*/
    browsers: ['Chrome', 'PhantomJS'],
    singleRun: true
    });
    };


    Don't know if it'll help but my package.json looks like this:



     {
    "name": "isms-frontend",
    "version": "0.0.0",
    "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "prepare": "patch-package"
    },
    "private": true,
    "dependencies": {
    "@angular/animations": "6.1.8",
    "@angular/cdk": "^6.4.7",
    "@angular/common": "6.1.8",
    "@angular/compiler": "6.1.8",
    "@angular/core": "6.1.8",
    "@angular/forms": "6.1.8",
    "@angular/http": "6.1.8",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "6.1.8",
    "@angular/platform-browser-dynamic": "6.1.8",
    "@angular/router": "6.1.8",
    "core-js": "^2.5.4",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "ngx-window-core": "^1.0.84",
    "rxjs": "6.3.2",
    "rxjs-compat": "6.3.2",
    "zone.js": "~0.8.26"
    },
    "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular-devkit/build-ng-packagr": "~0.8.0",
    "@angular/cli": "~6.2.1",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-phantomjs-launcher": "^1.0.4",
    "ng-packagr": "^4.1.0",
    "phantomjs-prebuilt": "^2.1.16",
    "patch-package": "^5.1.1",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tsickle": ">=0.29.0",
    "tslib": "^1.9.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2"
    }
    }


    Please let me know if any more information can help resolve this issue. Thanks in advance for your time!










    share|improve this question



























      0












      0








      0








      Hi people of the StackOverflow,



      I am stuck! My ng test fails, although ng serve builds and compiles this Angular 6 project with no issues. The error I am getting is the following:



      Karma fails



      Additionally, immediately after that Chrome fails, just as so:



      enter image description here



      I have little to no understanding of what's happening, but this issue prevents the successful deploy, as the build-street fails.



      As a big noob I am furiously going in a loop of trying to apply solutions that closely resembles my issue, but with no avail. That is why I am asking you guys for help! I've tried doing PhantomJS does not work with Karma in Angular2 project; put import 'zone.js/dist/zone' from polyfills.ts in the top of the file; updating PhantomJS and what not.



      My karma.conf.js is as follows:



      module.exports = function (config) {
      config.set({
      basePath: '',
      frameworks: ['jasmine', '@angular-devkit/build-angular'],
      plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
      ],
      /*...*/
      browsers: ['Chrome', 'PhantomJS'],
      singleRun: true
      });
      };


      Don't know if it'll help but my package.json looks like this:



       {
      "name": "isms-frontend",
      "version": "0.0.0",
      "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "prepare": "patch-package"
      },
      "private": true,
      "dependencies": {
      "@angular/animations": "6.1.8",
      "@angular/cdk": "^6.4.7",
      "@angular/common": "6.1.8",
      "@angular/compiler": "6.1.8",
      "@angular/core": "6.1.8",
      "@angular/forms": "6.1.8",
      "@angular/http": "6.1.8",
      "@angular/material": "^6.4.7",
      "@angular/platform-browser": "6.1.8",
      "@angular/platform-browser-dynamic": "6.1.8",
      "@angular/router": "6.1.8",
      "core-js": "^2.5.4",
      "hammerjs": "^2.0.8",
      "intl": "^1.2.5",
      "ngx-window-core": "^1.0.84",
      "rxjs": "6.3.2",
      "rxjs-compat": "6.3.2",
      "zone.js": "~0.8.26"
      },
      "devDependencies": {
      "@angular-devkit/build-angular": "~0.8.0",
      "@angular-devkit/build-ng-packagr": "~0.8.0",
      "@angular/cli": "~6.2.1",
      "@angular/compiler-cli": "^6.1.0",
      "@angular/language-service": "^6.1.0",
      "@types/jasmine": "~2.8.8",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "~8.9.4",
      "codelyzer": "~4.3.0",
      "jasmine-core": "~2.99.1",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~3.0.0",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.1",
      "karma-jasmine": "~1.1.2",
      "karma-jasmine-html-reporter": "^0.2.2",
      "karma-phantomjs-launcher": "^1.0.4",
      "ng-packagr": "^4.1.0",
      "phantomjs-prebuilt": "^2.1.16",
      "patch-package": "^5.1.1",
      "protractor": "~5.4.0",
      "ts-node": "~7.0.0",
      "tsickle": ">=0.29.0",
      "tslib": "^1.9.0",
      "tslint": "~5.11.0",
      "typescript": "~2.9.2"
      }
      }


      Please let me know if any more information can help resolve this issue. Thanks in advance for your time!










      share|improve this question
















      Hi people of the StackOverflow,



      I am stuck! My ng test fails, although ng serve builds and compiles this Angular 6 project with no issues. The error I am getting is the following:



      Karma fails



      Additionally, immediately after that Chrome fails, just as so:



      enter image description here



      I have little to no understanding of what's happening, but this issue prevents the successful deploy, as the build-street fails.



      As a big noob I am furiously going in a loop of trying to apply solutions that closely resembles my issue, but with no avail. That is why I am asking you guys for help! I've tried doing PhantomJS does not work with Karma in Angular2 project; put import 'zone.js/dist/zone' from polyfills.ts in the top of the file; updating PhantomJS and what not.



      My karma.conf.js is as follows:



      module.exports = function (config) {
      config.set({
      basePath: '',
      frameworks: ['jasmine', '@angular-devkit/build-angular'],
      plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
      ],
      /*...*/
      browsers: ['Chrome', 'PhantomJS'],
      singleRun: true
      });
      };


      Don't know if it'll help but my package.json looks like this:



       {
      "name": "isms-frontend",
      "version": "0.0.0",
      "scripts": {
      "ng": "ng",
      "start": "ng serve",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "prepare": "patch-package"
      },
      "private": true,
      "dependencies": {
      "@angular/animations": "6.1.8",
      "@angular/cdk": "^6.4.7",
      "@angular/common": "6.1.8",
      "@angular/compiler": "6.1.8",
      "@angular/core": "6.1.8",
      "@angular/forms": "6.1.8",
      "@angular/http": "6.1.8",
      "@angular/material": "^6.4.7",
      "@angular/platform-browser": "6.1.8",
      "@angular/platform-browser-dynamic": "6.1.8",
      "@angular/router": "6.1.8",
      "core-js": "^2.5.4",
      "hammerjs": "^2.0.8",
      "intl": "^1.2.5",
      "ngx-window-core": "^1.0.84",
      "rxjs": "6.3.2",
      "rxjs-compat": "6.3.2",
      "zone.js": "~0.8.26"
      },
      "devDependencies": {
      "@angular-devkit/build-angular": "~0.8.0",
      "@angular-devkit/build-ng-packagr": "~0.8.0",
      "@angular/cli": "~6.2.1",
      "@angular/compiler-cli": "^6.1.0",
      "@angular/language-service": "^6.1.0",
      "@types/jasmine": "~2.8.8",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "~8.9.4",
      "codelyzer": "~4.3.0",
      "jasmine-core": "~2.99.1",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~3.0.0",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.1",
      "karma-jasmine": "~1.1.2",
      "karma-jasmine-html-reporter": "^0.2.2",
      "karma-phantomjs-launcher": "^1.0.4",
      "ng-packagr": "^4.1.0",
      "phantomjs-prebuilt": "^2.1.16",
      "patch-package": "^5.1.1",
      "protractor": "~5.4.0",
      "ts-node": "~7.0.0",
      "tsickle": ">=0.29.0",
      "tslib": "^1.9.0",
      "tslint": "~5.11.0",
      "typescript": "~2.9.2"
      }
      }


      Please let me know if any more information can help resolve this issue. Thanks in advance for your time!







      angular google-chrome phantomjs karma-jasmine zone






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 0:22







      Maksim Dimitrov

















      asked Nov 22 '18 at 0:16









      Maksim DimitrovMaksim Dimitrov

      4818




      4818
























          1 Answer
          1






          active

          oldest

          votes


















          0














          After all the suffering I found out that all I had to do is pass an argument to ng test, just as ng test isms-frontend in my case. Found the answer from jorgjanke last comment from https://github.com/angular/angular-cli/issues/12581






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422223%2fphantomjs-chrome-fails-in-karma-test-with-zone-nat-script-error-in-an-angula%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            After all the suffering I found out that all I had to do is pass an argument to ng test, just as ng test isms-frontend in my case. Found the answer from jorgjanke last comment from https://github.com/angular/angular-cli/issues/12581






            share|improve this answer




























              0














              After all the suffering I found out that all I had to do is pass an argument to ng test, just as ng test isms-frontend in my case. Found the answer from jorgjanke last comment from https://github.com/angular/angular-cli/issues/12581






              share|improve this answer


























                0












                0








                0







                After all the suffering I found out that all I had to do is pass an argument to ng test, just as ng test isms-frontend in my case. Found the answer from jorgjanke last comment from https://github.com/angular/angular-cli/issues/12581






                share|improve this answer













                After all the suffering I found out that all I had to do is pass an argument to ng test, just as ng test isms-frontend in my case. Found the answer from jorgjanke last comment from https://github.com/angular/angular-cli/issues/12581







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 19:05









                Maksim DimitrovMaksim Dimitrov

                4818




                4818
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422223%2fphantomjs-chrome-fails-in-karma-test-with-zone-nat-script-error-in-an-angula%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith