Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karma finishes unexpectedly with no output? #6

Closed
thepian opened this issue Feb 14, 2016 · 4 comments
Closed

Karma finishes unexpectedly with no output? #6

thepian opened this issue Feb 14, 2016 · 4 comments
Labels

Comments

@thepian
Copy link

thepian commented Feb 14, 2016

Sorry in advance for a poor bug report.

I'm trying out the preprocessor and have it working without plugins, however it seems the rollup doesn't include the imports. I assume the Babel plugin is needed for things to work properly.

So I tried your example of adding rollup-plugin-babel, but when I do that the Karma server never takes off. There is no debug output, Karma just finishes.

Do you have any suggestions for how to debug this?

@thepian
Copy link
Author

thepian commented Feb 15, 2016

Actually I missed a cool part of rollup. Since I didn't refer to the imported source code it was removed ending up in a test without implementation. Once I referenced the source in a test it gets pulled in.

@thepian thepian closed this as completed Feb 15, 2016
@klaascuvelier
Copy link
Collaborator

Glad you were able to resolve your own issue :) 👍

@danini-the-panini
Copy link

danini-the-panini commented May 6, 2016

@thepian Hi, I seem to be getting the same issue as you. Karma is finishing with no output, however even if I reference the imported code it still does not work. I suspect it has something to do with the es2015 class syntax, as removing classes allows karma to run.

Here is a small example that reproduces my issue
// test/foo_test.js
import Foo from "../src/foo";

describe("foo", () => {
  it("bar", () => {
    assert.equal(new Foo().bar(), "baz");
  });
});
// src/foo.js

export default class Foo {
  bar() {
    return "baz";
  }
}
// karma.conf.js

module.exports = function(config) {
  config.set({
    basePath: "",
    frameworks: ["mocha", "chai"],
    files: [
      "test/**/*_test.js"
    ],
    preprocessors: {
      "test/**/*_test.js": ["rollup"]
    },
    exclude: [],
    rollupPreprocessor: {
      rollup: {
        plugins: [
          require("rollup-plugin-node-resolve")(),
          require("rollup-plugin-commonjs")({
            exclude: ["src/**", "test/**/*.js"]
          }),
          require("rollup-plugin-babel")({
            exclude: "node_modules/**",
            presets: [require("babel-preset-es2015-rollup")],
            babelrc: false
          })
        ]
      },
      bundle: {
        sourceMap: "inline"
      }
    },
    reporters: ["progress"],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: false,
    browsers: ["Chrome"],
    singleRun: true,
    concurrency: Infinity
  });
};

@jlmakes jlmakes changed the title Sorry in advance Karma finishes unexpectedly with no output? Nov 30, 2016
@jlmakes
Copy link
Owner

jlmakes commented Nov 30, 2016

I noticed an invalid configuration (specifically an invalid moduleName) was causing the Karma to fail silently. I believe this would have been resolved by a try/catch around bundle.generate(), but in my recent testing with the latest version of Rollup — this no longer seems necessary.

Also @jellymann, I know I'm late to the party but the error you describe is surely related to this one... seems to have been an issue with the specific combination of plug-ins you listed:

  • rollup-plugin-node-resolve
  • rollup-plugin-commonjs
  • rollup-plugin-babel

For what it's worth, I've had terrible luck combining Babel with Rollup... particularly in earlier versions of Node (where I suppose various ES2015 features aren't supported.)

Related #4

@jlmakes jlmakes added the bug label Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants