GithubHelp home page GithubHelp logo

karma-ava's Issues

Split bundle bugs

Browserifies b.external(ext) method suffers from a few issues when ext is another bundle.

  1. You must call b2.external(b1) before you call b1.bundle (browserify/browserify#1577). This makes it pretty useless for bundle splitting for karma-ava. The idea is to bundle ava once as an external to avoid the expense of bundling it for every single test.
  2. It's just buggy (browserify/browserify#1583)

lib/externalize-bundle.js pulls it's implementation directly from the browserify source. It solves 1, but 2 remains an issue.

Don't support babel to convert es6 ?

Some versions

Node version : v8.1.3
Karma-ava : v0.0.1
ava: github:jamestalmage/ava#karma-ava

Karma config

The config as follows:

let path = require('path');

module.exports = config => {
    config.set({
        frameworks: ['ava'],
        basePath: '',
        files: [
            './demo/ava.spec.js'
        ],
        browsers: ['Chrome'],
        plugins: [
            'karma-chrome-launcher',
            'karma-ava',
            'karma-sourcemap-loader',
            'karma-webpack',
            'karma-mocha-reporter'
        ],
        reporters: ['progress', 'mocha'],
        singleRun: true,
        autoRun: true,
        mochaReporter: {
            colors: {
                success: 'blue',
                info: 'bgGreen',
                warning: 'cyan',
                error: 'bgRed'
            },
            symbols: {
                success: '+',
                info: '#',
                warning: '!',
                error: 'x'
            }
        },
        preprocessors: {
            './demo/ava.spec.js': ['webpack', 'sourcemap'],
            './src/**/*.js': ['webpack', 'sourcemap']
        },
        logLevel: config.LOG_INFO,
        colors: true,
        webpack: {
            devtool: 'inline-source-map',
            module: {
                rules: [
                    {
                        test: /\.js$/,
                        exclude: /node_modules/,
                        include: [
                            path.resolve(__dirname, 'src')
                        ],
                        use: [{
                            loader: 'babel-loader',
                            options: {
                                presets: ['es2015']
                            }
                        }]
                    }
                ]
            },
            resolve: {
                extensions: ['.js'],
                modules: [path.join(__dirname, './node_modules')]
            }
        },
        webpackMiddleware: {
            noInfo: true
        }
    });
};

My directory hierarchy as follows:

-test
   -demo
        -ava.spec.js
   -src
        -css.js
        -helper.js
   -karma.config.ava.js

When run ./node_modules/.bin/karma start karma.conf.ava.js in terminal, I got some error as follows:

START:
06 08 2017 16:53:01.450:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
06 08 2017 16:53:01.452:INFO [launcher]: Launching browser Chrome with unlimited concurrency
Unhandled rejection
/Users/pomy/git/test/src/css.js:1
import { ownerDocument, checkToken } from './helper';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
06 08 2017 16:53:01.459:INFO [launcher]: Starting browser Chrome
06 08 2017 16:53:02.195:INFO [Chrome 59.0.3071 (Mac OS X 10.12.6)]: Connected on socket 2WXI-frxz-uhsFR0AAAA with id 37621167
Chrome 59.0.3071 (Mac OS X 10.12.6) ERROR
  You need to include some adapter that implements __karma__.start method!

Chrome 59.0.3071 (Mac OS X 10.12.6) ERROR
  You need to include some adapter that implements __karma__.start method!

ava.spec.js:

import test from 'ava';

import css from '../src/css';

// console.log('66666', typeof css);

test('foo', t => {
    // console.log(typeof css);
    t.is(1, 1);
});

css.js:

import { ownerDocument, checkToken } from './helper';

export default function css () { .... }

helper.js

export const ownerDocument =  function ownerDocument () { .... }
export const checkToken =  function checkToken () { .... }

Bug instantiating middleware

Trying to set up karma-ava. Getting this error. I'm using the latest version of ava, which I believe has the fix need to make karma-ava work. I've got what I've done so far here, with the relevant bits below:

"ava": "^0.17.0",
"karma-ava": "git+ssh://[email protected]/avajs/karma-ava.git",

Here's my karma.conf.js.

The stack trace for the error:

[11:59:35] Starting 'test:unit'...
15 01 2017 11:59:35.550:DEBUG [config]: autoWatch set to false, because of singleRun
15 01 2017 11:59:35.551:DEBUG [plugin]: Loading karma-* from /path/to/project/node_modules
15 01 2017 11:59:35.553:DEBUG [plugin]: Loading plugin /path/to/project/node_modules/karma-ava.
15 01 2017 11:59:35.702:DEBUG [plugin]: Loading plugin /path/to/project/node_modules/karma-phantomjs-launcher.
15 01 2017 11:59:35.727:DEBUG [plugin]: Loading plugin /path/to/project/node_modules/karma-spec-reporter.
15 01 2017 11:59:35.735:DEBUG [web-server]: Instantiating middleware
{ TypeError: Cannot read property 'match' of undefined while parsing file: /path/to/project/client/reducer/__tests__/editor.spec.js
    at Object.exports.fromSource (/path/to/project/node_modules/convert-source-map/index.js:122:18)
    at getSourceMap (/path/to/project/node_modules/ava/lib/babel-config.js:130:35)
    at Object.build (/path/to/project/node_modules/ava/lib/babel-config.js:113:18)
    at Babelify._flush (/path/to/project/node_modules/karma-ava/lib/babel-transform.js:38:38)
    at Babelify.<anonymous> (_stream_transform.js:118:12)
    at Object.onceWrapper (events.js:290:19)
    at emitNone (events.js:86:13)
    at Babelify.emit (events.js:185:7)
    at prefinish (_stream_writable.js:503:12)
    at finishMaybe (_stream_writable.js:511:7)
    at endWritable (_stream_writable.js:523:3)
    at Babelify.Writable.end (_stream_writable.js:488:5)
    at DuplexWrapper.<anonymous> (/path/to/project/node_modules/stream-combiner2/node_modules/duplexer2/index.js:29:14)
    at Object.onceWrapper (events.js:290:19)
    at emitNone (events.js:91:20)
    at DuplexWrapper.emit (events.js:185:7)
  filename: '/path/to/project/client/reducer/__tests__/editor.spec.js',

There isn't any way to hook into the babel configuration for karam-ava, although I don't know what configuration is required to make this work, as this error isn't familiar to me. I know there are still todos related to configuring karma-ava.

Ideas?

Status

Hello,

I'm curious if this is a project that is going to be developed further or not. I've been comparing mocha and ava, and I do like ava. But it also seems to get less attention than mocha (if I'm wrong, I apologize for misreading that).

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.