Coder Social home page Coder Social logo

karma-rollup-plugin's Introduction

karma-rollup-plugin's People

Contributors

greenkeeperio-bot avatar jlmakes avatar trysound avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

karma-rollup-plugin's Issues

Testing env

My office still use node0.12. I'm trying to force upgrade but it's not so fast. Also until rollup itself supports 0.12 any plugins and adapters should follow the same. Usually our travis conf looks like this

# sudo is not required since jan 2015
language: node_js
node_js:
  - "0.12"
  - "4"
  - "6"
env:
  global:
    - BUILD_TIMEOUT=10000
# node_js env knows what to do
# install: npm install
# script: npm run ci

Can I use multiple config in rollupPreprocessor?

Or how to use multiple config?

module.exports = (config) => {
  config.set({
    preprocessors: {
      'src/vendor.js': ['rollup'],  // 1
      'test/**/*.spec.js': ['rollup']  // 2
    },
    rollupPreprocessor: [
      { ... },  // 1
      { ... }  // 2
    ]
  });
};

Sourcemap applying

Rollup generates source maps. It's fine. But karma can't load them from string without sourcemap preprocessor. But better just add file.map and get rid from extra plugin.

Wrong dependencies

Pass debounce, rollup to regular dependencies instead of devDependencies.

no time to maintenance

@TrySound I have no time anymore to maintain this repo because I'm working on a huge project, and things are not completed yet. Should I transfer it to you? If not I think it will be deleted shortly.

Include directly from repository via npm/package.json

If one adds "karma-rollup-plugin": "Kflash/karma-rollup-plugin" to dependencies or devDependencies of package.json and runs npm install then node will fail with a "Cannot find plugin".

This is because package.json has "main": "dist/rollup-plugin-karma.js", but that is not present when npm install gets the package from Github.

There are a few options to resolve this e.g.

  1. keep a dist/ directory on master.
  2. add git tags releases/branches (and then package.json can reference that tagged version)
  3. include rollup.config.js in files of package.json (so it can be at least compiled without having to explicitly fetch it)

There may be other/better ways to resolve this, but I just thought I'd give a heads up since npm supports installation from repository, and it's probably the easiest way to try out and debug the latest.

Cheers.

Incremental build

Since one of the last releases rollup introduced cache option which accepts previously built bundle and contain transformed content and maps.

let cache = null;

rollup.rollup({
  entry: '...',
  plugins: [buble()],
  cache
}).then(bundle => {
  cache = bundle;
});

rollup.rollup({
  entry: '...',
  plugins: [buble()],
  cache // contains buble transformations
}).then(bundle => {
  cache = bundle;
});

bundle.generate(...) now returns a Promise instead of a { code, map } object

rollup version: 0.45.2

config:

preprocessors: {
      '__test__/index.js': ['rollup']
    },
    rollupPreprocessor: {
      plugins: [
        postcss({
          plugins: [
            cssnext()
          ],
          extensions: ['.css']
        }),
        babel({
          presets: ['es2015-rollup', 'stage-0'],
          plugins: [
            'transform-decorators-legacy',
            'transform-runtime'
          ],
          exclude: 'node_modules/**',
          runtimeHelpers: true,
          babelrc: false
        }),
        resolve(),
        commonjs()
      ],
      format: 'iife',
      sourceMap: 'inline'
    },

terminal console.log: bundle.generate(...) now returns a Promise instead of a { code, map } object

resolve: rollup issues

Karma not watching preprocessed files

When setting rollup to preprocess my tests, the autowatch is identifying the tests as not being in the files list and the following message is being shown:

Changed file "/path/to/test.js" ignored. Does not match any file in the list.

However, when disabling the plugin it works as expected.
This is my config file:

const buble = require('rollup-plugin-bible');

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine'],
    files: [ 'tests/**/*.js' ],
    rollupPreprocessor: {
      plugins: [ buble() ],
      format: 'es',
    },
    preprocessors: {
     'tests/**/*.js': ['rollup']
    },
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['PhantomJS'],
    singleRun: false,
    concurrency: Infinity
  })
}

Redundant console.log published

Version 0.23, line 46 of dist/rollup-plugin-karma.js has this:

console.log(files);

Since I don't see this in the repo, I guess something wrong was published.

regression since 0.2.3

I noticed that in one of my projects karma tests started failing in a combination with Jasmine (jasmine.js missing). If I revert to 0.2.2 everything is fine. Here's my repo and karma configuration if it's helpful: angular2-rollup-starter. Btw, thanks for this plugin!

The debounce needs to be factored out

The debounce on line 45 is creating a new debounced' function for every dependency of every processed file. This exponentially increases the computational complexity.

The debounce'd function definition should be moved outside the createPreprocessor function. e.g.

let triggerUpdateChanges = debounce(() => {
                                    let now = new Date();
                                    for (let idx = 0, lst = changedParents.values(); idx < lst.length; idx += 1) {
                                        fs.utimes(lst[idx], now, now);
                                    }
                                    changedParents.clear();
                                }, WAIT)

Then line 45 would just be triggerUpdateChanges().

2 latest versions doesn't work - code issues

@TrySound I have to revert some of your source fixes because something weird happen. It doesn't work anymore. SyntaxError: Unexpected token ')' Seems like Rollup isn't invoked?

Actually no time for this atm, but I have no choices rather then fix this :(

Prefer buble to babel

There is buble/register hook. This will make tests a bit more consistent to source code.

// You don't need to specify exact path. `package.json` `main` field will be resolved perfectly.
const karmaRollupPlugin = require('../../');

Debug?

@TrySound Should there be possible to debug the preprocessor? Maybe not possible because it will rely on Rollup and there is no build in debug feature.

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.