GithubHelp home page GithubHelp logo

Comments (6)

dwightjack avatar dwightjack commented on September 1, 2024 1

@maksimr @Inf3rno

Thanks! Was able to fix the problem with:

const fixMocha = function(files) {
  files.unshift({
    pattern: path.resolve('./node_modules/core-js/client/core.js'),
    included: true,
    served: true,
    watched: false
  });
};

fixMocha.$inject = ['config.files'];

module.exports = (config) => {
  config.set({
     ...
     frameworks: ['mocha', 'inline-mocha-fix'],

     plugins: [
        'karma-*',
        {
            'framework:inline-mocha-fix': ['factory', fixMocha]
        }
     ],
     ...
  });
};

I'm using core-js but I think it should work with other libraries as well

from karma-mocha.

dwightjack avatar dwightjack commented on September 1, 2024

+1 On this.

Having the same problem testing on Saucelab with ie9.

from karma-mocha.

maksimr avatar maksimr commented on September 1, 2024

@Inf3rno you could create custom inline framework. For example:

    frameworks: ['mocha', 'inlnie-mocha-fix'],
    plugins: [
      'karma-*',
      {
        'framework:inline-mocha-fix': ['factory', function() {
            ...
        }]
      }
    ],

https://karma-runner.github.io/2.0/dev/plugins.html

By the way, I think it's a mocha's bug so feel free open issue there

Thanks!

from karma-mocha.

 avatar commented on September 1, 2024

@dwightjack Thanks, it looks great! :-)

from karma-mocha.

jslegers avatar jslegers commented on September 1, 2024

By the way, I think it's a mocha's bug so feel free open issue there

The Mocha devs officially dropped support for IE9 & IE10 in v5 of Mocha. See mochajs/mocha#3164.

So one might argue that this is a feature rather than a bug 😉

from karma-mocha.

jslegers avatar jslegers commented on September 1, 2024

Anyway, do I understand correctly that the described approach polyfills everything that is loaded instead of just mocha?

If that is indeed the expected behavior, I don't think this is a suitable approach for a test runner.

The whole point of testing in IE9 & IE10 is usually to detect whether those browsers don't break because you rely on features not present in such old browsers. Adding a polyfill for ES6 features in your test environment kinda prevents you from detecting this problem.

I'd rather just use Mocha v4 instead.

from karma-mocha.

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.