Giter Club home page Giter Club logo

Comments (10)

KidkArolis avatar KidkArolis commented on May 18, 2024

In case of tests this 892 modules of which 295 are transpiled with babel.

from karma-webpack.

sokra avatar sokra commented on May 18, 2024

Do you use the alternative useage?

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

Yes. I think the test bundle takes 30-40 seconds to compile if I use babel. And 10 seconds without babel which is acceptable. Maybe this project is just too large, or maybe I shouldn't be always running all tests - but the latter is not easy with karma.

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

I'm thinking about building another karma-webpack like plugin which allows a --grep arg to filter which test files get bundled. Is that of interest to anyone? :-"

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

I think I managed to add some simple grepping via ContextReplacementPlugin

// my test-main.js
var testsContext = require.context("../..", true, /_test$/);
testsContext.keys().forEach(testsContext);

// karma.config.js
...
if (argv.grep) {
    webpackConfig.plugins = _.union(webpackConfig.plugins, [
      new webpack.ContextReplacementPlugin(new RegExp('../..'), function (result) {
        result.regExp = new RegExp('.*' + argv.grep + '.*_test$');
      })
    ]);
  }
...

This allows me to run karma start --grep foo to filter some subset of tests to build with webpack, leaving full test runs to CI.

from karma-webpack.

mtscout6 avatar mtscout6 commented on May 18, 2024

I just gave this a try and my test time increased by 2 seconds... Very odd.

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

Perhaps that's the case for small sets of tests. For me, when I grep a small subset of tests, the time decreases from 2minutes to 15 seconds.

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

I've just blogged about the --grep trick https://medium.com/@kidkarolis/karma-webpack-grep-super-fast-tests-in-dev-b11130e2c2c6 in case anyone's interested.

from karma-webpack.

larryhe avatar larryhe commented on May 18, 2024

Hi @KidkArolis nice post. I had a similar issue as yours due to our very large code base. Your post may solve our test problem. But I wonder how do you solve your incremental build issue (you should also have). I run webpack in watch mode, but whenever I change a file, it takes over 1 minute to compile&bundle which is way too long for developer.

from karma-webpack.

KidkArolis avatar KidkArolis commented on May 18, 2024

In my experience the incremental build is only slow if you use the wrong
sourcemap (devtool) option. Try them all to find the fast one..
On Fri, 12 Feb 2016 at 17:55, Larry He [email protected] wrote:

Hi @KidkArolis https://github.com/KidkArolis nice post. I had a similar
issue as yours due to our very large code base. Your post may solve our
test problem. But I wonder how do you solve your incremental build issue
(you should also have). I run webpack in watch mode, but whenever I change
a file, it takes over 1 minute to compile&bundle which is way too long for
developer.


Reply to this email directly or view it on GitHub
#47 (comment)
.

from karma-webpack.

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.