avajs / karma-ava Goto Github PK
View Code? Open in Web Editor NEWKarma plugin for AVA
Home Page: https://ava.li
License: MIT License
Karma plugin for AVA
Home Page: https://ava.li
License: MIT License
Node version : v8.1.3
Karma-ava : v0.0.1
ava: github:jamestalmage/ava#karma-ava
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 () { .... }
Only if karma-phantomjs-launcher
is a devDependency of course.
From https://github.com/sindresorhus/any-observable/pull/16/files#r68935463
I've tried pushing the karma-ava
alpha to its limits by trying to add code coverage, unfortunately without much success. karma-coverage
generates code empty coverage, even though code is being included and processed properly.
24 08 2016 19:07:28.510:ERROR [plugin]: Error during loading "karma-ava" plugin:
Cannot find module 'ava/lib/prefix-title'
EDIT: See the comment below for full context.
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 todo
s related to configuring karma-ava
.
Ideas?
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).
Browserifies b.external(ext)
method suffers from a few issues when ext
is another bundle.
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.lib/externalize-bundle.js
pulls it's implementation directly from the browserify source. It solves 1
, but 2
remains an issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.