GithubHelp home page GithubHelp logo

Comments (5)

joeljeske avatar joeljeske commented on April 24, 2024

Interesting, I have not seen this error. Could you post your karma-config file somewhere? Also, can you run your karma suite in debug mode (--log-level debug) and post the logs here?

from karma-parallel.

aurimas-darguzis avatar aurimas-darguzis commented on April 24, 2024

Hi joeljeske, thank you for coming back to promptly. Here is the karma-config file:
As for the logs - do you mean simply copy paste log info from the console, or is there a file somewhere that karma dumps all the logs? Sorry for the last part, I don't use karma very often.

module.exports = function(config) {
  config.set({
    basePath: './',
    frameworks: ['parallel', 'jasmine'],
    files: [
      'node_modules/babel-polyfill/browser.js',
      { pattern: 'karma-test-shim.ts', watched: false },
      { pattern: 'src/**/*.spec.ts', watched: true }
    ],
    exclude: [],
    preprocessors: {
      '**/*.ts': ['webpack']
    },
    reporters: ['progress', 'bamboo'],
    port: 1111,
    colors: true,
    customLaunchers: {
      ChromeCustom: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },
    browsers: ['ChromeCustom'],
    singleRun: true,
    concurrency: Infinity,
    webpack: require('./webpack-karma.config'),
    webpackMiddleware: {
      noInfo: true
    },
    plugins: [
      require('karma-parallel'),
      require('karma-bamboo-reporter'),
      require('karma-webpack'),
      require('karma-chrome-launcher'),
      require('karma-jasmine')
    ],
    parallelOptions: {
      executors: 4, // Defaults to cpu-count - 1
      shardStrategy: 'round-robin'
      // shardStrategy: 'description-length'
    },
    mime: { 'text/x-typescript': ['ts', 'tsx'] }
  });
};

from karma-parallel.

joeljeske avatar joeljeske commented on April 24, 2024

I just mean copying and pasting the stdout/err here. Passing the That debug flag provides more useful information

from karma-parallel.

 avatar commented on April 24, 2024

I have gotten the same error.

HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1
HeadlessChrome 67.0.3396 (Ubuntu 0.0.0) ERROR
  Uncaught SyntaxError: Unexpected token % in JSON at position 0
  at http://localhost:9876/context.html:1

Finished in 7.806 secs / 0 secs @ 09:48:25 GMT+0300 (IDT)

SUMMARY:
✔ 0 tests completed
No type errors found
Version: typescript 3.0.1
Time: 34245ms

From some investigation, it falls on web initial file loading script
https://github.com/joeljeske/karma-parallel/blob/master/lib/karma-parallelizer.js#L155

The %KARMA_SHARD_INFO% variable was not replaced so it understandable why json.parse failed.

It seems the beforeMiddleware is not executed
https://github.com/joeljeske/karma-parallel/blob/master/lib/middleware.js#L39

I traced in back to our karma version which was a very old one that did not have support for before middlewares. After updating Karma to the latest version ( > 2.0) this error was resolved.

from karma-parallel.

joeljeske avatar joeljeske commented on April 24, 2024

Yes, we do not support karma < v1. I have added an explicit peer dependency to ensure awareness when installing the package.

Thanks!

from karma-parallel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.