Skip to content

Instantly share code, notes, and snippets.

@taizawa
Last active January 6, 2016 07:47
Show Gist options
  • Save taizawa/9cbbce27772fe5f1a891 to your computer and use it in GitHub Desktop.
Save taizawa/9cbbce27772fe5f1a891 to your computer and use it in GitHub Desktop.
karma.conf.js + .babelrc + package.json
// Karma configuration
// Generated on Mon Jan 04 2016 14:26:34 GMT+0900 (JST)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
// list of files / patterns to load in the browser
files: [
'test/*.ts'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/*.ts': ['webpack']
},
plugins: [
'karma-webpack',
'karma-mocha',
'karma-chrome-launcher',
'babel-plugin-espower'
],
webpack: {
resolve: {
extensions: ['', '.tsx', '.ts', '.js', '.css'],
},
module: {
loaders: [
{
test: /\.tpl\.html$/,
loader: 'raw',
},
{
test: /\.json$/,
loader: "json"
},
{
test: /\.ts?$/,
loaders: [
'ng-annotate',
'babel',
'ts-loader?ignoreDiagnostics[]=2307,2304,2351,6053'
],
exclude: /\/(node_modules|bower_components)\//,
}
]
}
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
})
}
// .babelrc
{
"presets": [
"es2015"
],
"plugins": [
"babel-plugin-espower"
]
}
// package.json
{
"name": "visasq-webapp-mobile",
"version": "0.1.0",
"author": "Tatsuya Aizawa",
"dependencies": {
"angular": "^1.4.7",
"angular-ui-router": "^0.2.15",
"angular-ui-router.statehelper": "^1.3.1",
"superagent": "^1.4.0"
},
"engines": {
"node": "^5"
},
"devDependencies": {
"babel-core": "^6.1.2",
"babel-loader": "^6.0.1",
"babel-plugin-espower": "^2.0.0",
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"espower-babel": "^4.0.1",
"gulp": "~3.8.11",
"gulp-autoprefixer": "~2.3.0",
"gulp-concat": "~2.5.2",
"gulp-if": "~1.2.5",
"gulp-minify-css": "~1.1.1",
"gulp-plumber": "~1.0.1",
"gulp-stylus": "~2.0.2",
"gulp-typescript": "^2.10.0",
"gulp-uglify": "~1.2.0",
"gulp-watch": "~4.2.4",
"gulp-webpack": "~1.1.0",
"jasmine-core": "^2.4.1",
"json-loader": "^0.5.4",
"karma": "^0.13.16",
"karma-chrome-launcher": "^0.2.2",
"karma-mocha": "^0.2.1",
"karma-typescript-preprocessor": "0.0.21",
"karma-webpack": "^1.7.0",
"ng-annotate-loader": "0.0.10",
"power-assert": "~0.11.0",
"raw-loader": "^0.5.1",
"require-dir": "~0.3.0",
"ts-loader": "^0.7.2",
"tsd": "^0.6.5",
"typescript": "^1.8.0-dev.20160103",
"webpack": "^1.12.9"
},
"scripts": {
"watch": "gulp",
"test": "karma start karma.conf.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment