Created
March 1, 2016 20:19
-
-
Save ajcrites/4c173366035fd223bfbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
module.exports = config => config.set({ | |
frameworks: ['jasmine', 'chai-sinon'], | |
reporters: ['progress'], | |
files: ['test.webpack.js'], | |
preprocessors: { | |
'test.webpack.js': ['webpack', 'sourcemap'], | |
}, | |
browsers: ['PhantomJS2'], | |
webpack: require('./webpack.config'), | |
webpackMiddleware: { | |
noInfo: 'errors-only', | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('MainCtrl', () => { | |
let $controller; | |
beforeEach(inject(_$controller_ => { | |
$controller = _$controller_; | |
})); | |
function createCtrl() { | |
return $controller('MainCtrl'); | |
} | |
describe('calculations', () => { | |
it('adds two numbers', () => { | |
const controller = createCtrl(); | |
controller.add(1, 2); | |
expect(controller.result).to.equal(3); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'angular'; | |
import 'angular-mocks/angular-mocks'; | |
const testContext = require.context('./', true, /\.spec\.js$/); | |
testContext.keys().forEach(testContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* Configuration for Angular webpack development server | |
* TODO also allow building for production | |
*/ | |
const webpack = require('webpack'); | |
const path = require('path'); | |
let config = { | |
target: 'web', | |
entry: {}, | |
output: {}, | |
resolve: { | |
modulesDirectories: [ | |
'web_modules', | |
'node_modules', | |
'client', | |
], | |
extentions: ['js', 'html'], | |
}, | |
plugins: [ | |
new webpack.DefinePlugin({ | |
__DEV__: 'development' === process.env.NODE_ENV, | |
__STAGING__: 'staging' === process.env.NODE_ENV, | |
__PRODUCTION__: 'production' === process.env.NODE_ENV, | |
__CURRENT_ENV__: '\'' + (process.env.NODE_ENV) + '\'', | |
}), | |
], | |
module: { | |
noParse: /\.min\.js/ | |
}, | |
node: { | |
net: 'empty', | |
tls: 'empty', | |
dns : 'empty' | |
} | |
}; | |
if ('test' !== process.env.NODE_ENV) { | |
config.entry = [ | |
'webpack-dev-server/client?http://localhost:3001', | |
'webpack/hot/dev-server', | |
'./ng/client/index.js', | |
]; | |
config.output = { | |
path: path.join(process.cwd(), '/ng/client/index.js'), | |
pathInfo: true, | |
publicPath: 'http://localhost:3002/client/', | |
filename: 'main.js' | |
}; | |
config.devtool = 'eval-source-map'; | |
} | |
else { | |
config.devtool = 'inline-source-map'; | |
} | |
config.plugins = config.plugins.concat([ | |
new webpack.HotModuleReplacementPlugin(), | |
]); | |
n | |
config.module.loaders = [ | |
{test: /\.js$/, loaders: ['ng-annotate', 'babel?presets[]=es2015&presets[]=angular'], exclude: /node_modules/}, | |
{test: /\.html$/, loaders: ['html']}, | |
]; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment