Permalink
Browse files

Added linting and karma

  • Loading branch information...
edwardridge committed Nov 9, 2015
1 parent a2a5eb8 commit 92ba6c092e262261171c642aa765129238e00283
@@ -20,6 +20,7 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -125,6 +126,7 @@
<Content Include="fonts\glyphicons-halflings-regular.svg" />
<Content Include="Global.asax" />
<Content Include="gulpfile.js" />
<Content Include="karma.conf.js" />
<Content Include="Scripts\Libraries\bootstrap.js" />
<Content Include="Scripts\Libraries\bootstrap.min.js" />
<Content Include="Scripts\Libraries\jquery.js" />
@@ -138,6 +140,8 @@
<Content Include="Scripts\Libraries\respond.js" />
<Content Include="Scripts\Libraries\respond.min.js" />
<Content Include="Scripts\Libraries\_references.js" />
<Content Include="Scripts\main.js" />
<Content Include="Scripts\Specs\tests.js" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
Binary file not shown.
@@ -0,0 +1,5 @@
describe("A suite", function () {
it("contains spec with an expectation", function () {
expect(foo.addTwoNumbers(1, 2)).toBe(3);
});
});
@@ -0,0 +1,11 @@
var foo = (function () {
"use strict";
return {
addTwoNumbers: function (x, y) {
return x + y;
}
}
}());
@@ -1,6 +1,7 @@
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
gulp.task('sass', function () {
gulp.src('./Content/*.scss')
.pipe(plugins.sourcemaps.init())
@@ -52,4 +53,30 @@ gulp.task('watch-sass', function () {
gulp.watch('./Content/*.scss', ['sass']);
});
var sources = ['./Scripts/*.js', '!./Scripts/libs/*.js'];
gulp.task('watch-lint', function () {
gulp.watch(sources, ['lint']);
});
gulp.task('lint', function () {
return gulp.src(sources)
.pipe(plugins.jshint({
strict: true,
predef: [""]
}))
.pipe(plugins.jshint.reporter('default'))
.pipe(plugins.jshint.reporter('fail'))
;
});
var Server = require('karma').Server;
gulp.task('runTests', function () {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}).start();
});
gulp.task('default', ['watch-sass']);
@@ -0,0 +1,17 @@
module.exports = function (config) {
config.set({
files: ['./Scripts/*.js',
'./Scripts/Specs/**/*.js',
],
exclude: ['./Scripts/libs/*.js'],
frameworks: ['jasmine'],
autoWatchBatchDelay: 1000,
reporters: ['progress'],
browsers: ['PhantomJS']
});
};
@@ -1,4 +1,4 @@
{
{
"scripts": { "install": "echo Done" },
"devDependencies": {
@@ -13,7 +13,11 @@
"gulp-minify-css": "~1.2.1",
"gulp-rev": "~5.1.0",
"gulp-rev-replace": "~0.4.2",
"gulp-filter": "~3.0.0"
"gulp-filter": "~3.0.0",
"gulp-jshint": "~1.11.2",
"karma-jasmine": "~0.3.6",
"karma": "~0.13.9",
"karma-phantomjs-launcher": "~0.2.1"
}
}

0 comments on commit 92ba6c0

Please sign in to comment.