tomastrajan / angular-js-es6-testing-example Goto Github PK
View Code? Open in Web Editor NEWEnhanced testing of Angular JS 1.X applications using ES6 modules
License: MIT License
Enhanced testing of Angular JS 1.X applications using ES6 modules
License: MIT License
Couldn't see a good example of this here.
Do you not get this error on your second test?
On my first test, this line will work angular.mock.module('app');
but on my second it
it will not and will throw that error.
Not really crucial, just wanted to let you know this.
Switching features throws this in the console.
(Don't see any problem though unless I open the console.)
TypeError: realRunner.done is not a function
at angular-animate.js:2473
at Scope.$digest (angular.js:15946)
at Scope.$apply (angular.js:16160)
at angular.js:17927
at completeOutstandingRequest (angular.js:5552)
at angular.js:5829
hi Tomas @tomastrajan I found my webpack.karma.context.js is included in coverage report,how can I exclude it? thanks
webpack.karma.context.js
let context = require.context('./app', true, /\.js/); context.keys().forEach(context);
karma.conf.js
`var webpack = require('webpack');
var path = require('path');
var webpackConfig = require('./webpack.config');
webpackConfig.entry = {};
webpackConfig.output = {};
webpackConfig.module.preLoaders = [
{
test: /.test.js$/,
include: /app/,
exclude: /node_modules/,
loader: 'babel',
query: {
cacheDirectory: true,
},
},
{
test: /.js?$/,
include: /app/,
exclude: [/node_modules/, /.test.js$/, /webpack.karma.context.js/],
loader: 'babel-istanbul',
query: {
cacheDirectory: true,
},
},
{
test: /.html$/,
loader: 'html',
query: {
minimize: true
}
}
];
module.exports = function(config) {
config.set({
browsers: ['Chrome'],
frameworks: ['jasmine'],
reporters: ['progress', 'coverage', 'spec'],
coverageReporter: {
// output coverage reports
//type : 'html',
dir : 'coverage/',
reporters: [
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
{type: 'html', dir : 'coverage/',}
],
includeAllSources: true
},
logLevel: config.LOG_INFO, //config.LOG_INFO, config.LOG_DEBUG
autoWatch: true,
singleRun: false,
colors: true,
port: 9876,
basePath: '',
webpack:webpackConfig,
files: [ { pattern: 'webpack.karma.context.js', watched: false } ],
preprocessors: { 'webpack.karma.context.js': ['webpack', 'sourcemap', 'coverage'] },
exclude: [],
webpackServer: {
noInfo: true,
},
concurrency: Infinity,
plugins:[
require('karma-webpack'),
'karma-chrome-launcher',
'karma-jasmine',
'karma-coverage',
'karma-spec-reporter',
'karma-sourcemap-loader'
]
});
};`
webpack.config.js
`var webpack = require('webpack');
const prod = process.argv.indexOf('-p') !== -1;
/*
if (prod) { config.devtool = false;
config.plugins.push( new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}) );
config.plugins.push( new webpack.optimize.UglifyJsPlugin({ minimize: true, comments: false, compressor:{warnings:false} }) );
};
module.exports = config;
`
Hi there, First off, thanks for sharing this example. Can you extend this example to include unit test coverage reports?
Sadly also problems here:
$ npm install
...
npm ERR! Darwin 12.6.0
npm ERR! argv "/usr/local/bin/node" "/Users/dmitrizaitsev/.npm-global/bin/npm" "i" "-d"
npm ERR! node v4.2.4
npm ERR! npm v3.5.3
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/mocha-babel
npm ERR! 404
npm ERR! 404 'mocha-babel' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'angular-js-es6-testing-example'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dmitrizaitsev/Repos/angular-js-es6-testing-example/npm-debug.log
Not an issue but suggestion to add to:
https://github.com/gianarb/awesome-angularjs
I think it this example is awesome and deserves to be there :)
Hi ,
I am trying to install csslint through sublimeLinter.I keep getting the following error :
Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "csslint."
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/csslint.
npm ERR! 404
npm ERR! 404 'csslint.' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Here is the content from the log file :
node_modules/npm/node_modules/npm-registry-client/lib/request.js:280:14)
27 verbose stack at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:210:14)
27 verbose stack at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:187:22)
27 verbose stack at emitTwo (events.js:106:13)
27 verbose stack at Request.emit (events.js:191:7)
27 verbose stack at Request. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1048:10)
27 verbose stack at emitOne (events.js:96:13)
27 verbose stack at Request.emit (events.js:188:7)
27 verbose stack at IncomingMessage. (/usr/local/lib/node_modules/npm/node_modules/request/request.js:969:12)
28 verbose statusCode 404
29 verbose pkgid csslint.
30 verbose cwd /private/var/root
31 error Darwin 13.4.0
32 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "csslint."
33 error node v6.9.5
34 error npm v3.10.10
35 error code E404
36 error 404 Registry returned 404 for GET on https://registry.npmjs.org/csslint.
37 error 404
38 error 404 'csslint.' is not in the npm registry.
39 error 404 You should bug the author to publish it (or use the name yourself!)
40 error 404 Note that you can also install from a
41 error 404 tarball, folder, http url, or git url.
42 verbose exit [ 1, true ]
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.