Code Monkey home page Code Monkey logo

Comments (7)

edoloughlin avatar edoloughlin commented on May 21, 2024

I logged more info at http://stackoverflow.com/questions/24119506/karma-jasmine-times-out-without-running-tests but there's no activity on it.

from karma-webpack.

DylanLukes avatar DylanLukes commented on May 21, 2024

+1

from karma-webpack.

nmccready avatar nmccready commented on May 21, 2024

My stuff was working and now I have hit this... ugh

from karma-webpack.

nmccready avatar nmccready commented on May 21, 2024

So I tweaked index.js with this.

var sha1 = function(data) {
    var hash = crypto.createHash('sha1');
    console.info("SHA1 DATA: " + data);
    hash.update(data);
    return hash.digest('hex');
};

function createPreprocesor(/* config.basePath */basePath, webpackPlugin, logger, config) {
    var log = logger.create("preprocessor.webpack");
    return function(content, file, done) {
        webpackPlugin.karmaWaitsForPreprocessing = true;


        webpackPlugin.addFile(file.path);

        // recompile
        webpackPlugin.server.invalidate()
        log.info("basePath: " + basePath);
        log.info("file.path: " + file.path);
        // read blocks until bundle is done
        webpackPlugin.readFile(path.relative(basePath, file.path), function(err, content) {
            log.info("CONTENT BLOCK: " + content);
            if(!content){
                log.error('ERROR!!! NO CONTENT to process for hash!');
                log.error('ERROR!!! err: ' + err);
                return
            }
            webpackPlugin.karmaWaitsForPreprocessing = false;
            // Hack: file.sha
            //
            // Karma v0.12 assumes preprocessing is idempotent - always returns the same result on the same input.
            // That's not true with karma-webpack. Not setting file.sha causes browser to use a cached file.
            file.sha = sha1(content);
            done(err, content && content.toString("utf-8"));
        });
    };
}

Which now gives me a better error:

╰─○ karma start
KarmaConfig: [object Object]
INFO [karma]: Karma v0.12.22 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
Hash: 606dfda4c9d20a78987a
Version: webpack 1.3.3-beta2
Time: 30ms
     Asset  Size  Chunks             Chunk Names
index.html  1129          [emitted]
webpack: bundle is now VALID.
webpack: bundle is now INVALID.
INFO [preprocessor.webpack]: basePath: /Users/nem/code/github/nmccready/rmaps/map
INFO [preprocessor.webpack]: file.path: /Users/nem/code/github/nmccready/rmaps/map/spec/app/karmaSanity.spec.coffee
INFO [preprocessor.webpack]: CONTENT BLOCK: undefined
ERROR [preprocessor.webpack]: ERROR!!! NO CONTENT to process for hash!
ERROR [preprocessor.webpack]: ERROR!!! err: Error: Path doesn't exists /_js/spec/app/karmaSanity.spec.coffee
Hash: d86dd6b2d6a1a0181b3c
Version: webpack 1.3.3-beta2
Time: 74ms
                                   Asset  Size  Chunks             Chunk Names
    _js/spec/app/karmaSanity.spec.coffee  2003       0  [emitted]  spec/app/karmaSanity.spec.coffee
_js/spec/app/karmaSanity.spec.coffee.map  2320       0  [emitted]  spec/app/karmaSanity.spec.coffee
                              index.html  1129          [emitted]
chunk    {0} _js/spec/app/karmaSanity.spec.coffee, _js/spec/app/karmaSanity.spec.coffee.map (spec/app/karmaSanity.spec.coffee) 421 [rendered]

from karma-webpack.

nmccready avatar nmccready commented on May 21, 2024

Turned out the plugin

new HtmlWebpackPlugin
  template: 'app/html/index.html'

was causing all the ruckas. I will PR my logging changes as I feel it is helpful.

from karma-webpack.

farridav avatar farridav commented on May 21, 2024

Hi @nmccready Im having the same issue, and im also using HtmlWebpackPlugin, did you manage to find a resolution?

from karma-webpack.

nmccready avatar nmccready commented on May 21, 2024

I can't remember if I made a PR or if it got shot down. Anyways the work is here https://github.com/realtymaps/karma-webpack and https://github.com/nmccready/karma-webpack

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.