Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jsTestDriver demo #162

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 28 additions & 38 deletions Gruntfile.js
@@ -1,37 +1,28 @@
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);

// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);

// Define the configuration for all the tasks
grunt.initConfig({

// Project settings
yeoman: {
// Configurable paths
app: 'book',
dist: 'dist'
},

// Watches files for changes and runs tasks based on the changed files
watch: {
js: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
tasks: ['jshint'],
options: {
livereload: true
}
tasks: ['jshint']
},
jstest: {
files: ['test/spec/{,*/}*.js'],
Expand All @@ -50,7 +41,7 @@ module.exports = function (grunt) {
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
livereload: true
},
files: [
'<%= yeoman.app %>/{,*/}.html',
Expand All @@ -59,14 +50,13 @@ module.exports = function (grunt) {
]
}
},

// The actual grunt server settings
connect: {
options: {
port: 9000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
hostname: '127.0.0.1'
},
livereload: {
options: {
Expand Down Expand Up @@ -94,7 +84,6 @@ module.exports = function (grunt) {
}
}
},

// Empties folders to start fresh
clean: {
dist: {
Expand All @@ -109,7 +98,6 @@ module.exports = function (grunt) {
},
server: '.tmp'
},

// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
Expand All @@ -122,8 +110,6 @@ module.exports = function (grunt) {
'test/spec/{,*/}*.js'
]
},


// Mocha testing framework configuration options
mocha: {
all: {
Expand All @@ -133,9 +119,6 @@ module.exports = function (grunt) {
}
}
},



// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
Expand Down Expand Up @@ -163,7 +146,6 @@ module.exports = function (grunt) {
}
}
},

// Add vendor prefixed styles
autoprefixer: {
options: {
Expand All @@ -178,15 +160,13 @@ module.exports = function (grunt) {
}]
}
},

// Automatically inject Bower components into the HTML file
'bower-install': {
app: {
html: '<%= yeoman.app %>/index.html',
ignorePath: '<%= yeoman.app %>/'
}
},

// Renames files for browser caching purposes
rev: {
dist: {
Expand All @@ -200,7 +180,6 @@ module.exports = function (grunt) {
}
}
},

// Reads HTML for usemin blocks to enable smart builds that automatically
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
Expand All @@ -210,7 +189,6 @@ module.exports = function (grunt) {
},
html: '<%= yeoman.app %>/index.html'
},

// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
options: {
Expand All @@ -219,7 +197,6 @@ module.exports = function (grunt) {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
},

// The following *-min tasks produce minified files in the dist folder
imagemin: {
dist: {
Expand Down Expand Up @@ -261,7 +238,6 @@ module.exports = function (grunt) {
}]
}
},

// By default, your `index.html`'s <!-- Usemin block --> will take care of
// minification. These next options are pre-configured if you do not wish
// to use the Usemin blocks.
Expand All @@ -287,7 +263,6 @@ module.exports = function (grunt) {
// concat: {
// dist: {}
// },

// Copies remaining files to places other tasks can use
copy: {
dist: {
Expand All @@ -313,9 +288,6 @@ module.exports = function (grunt) {
src: '{,*/}*.css'
}
},



// Run some tasks in parallel to speed up build process
concurrent: {
server: [
Expand All @@ -330,15 +302,34 @@ module.exports = function (grunt) {
'imagemin',
'svgmin'
]
},
jasmine: {
pivotal: {
//src: ['test/spec/*.js'],
options: {
specs: [
'book/bower_components/jquery/dist/jquery.min.js',
'test/spec/ui.js',
'test/spec/native.js',
'test/spec/ui-test.js'
],
//outfile:'test.html'
//helpers: 'test/es6-firefox/utilities.js'
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
}
});


grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('serve', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}

grunt.task.run([
'clean:server',
'concurrent:server',
Expand All @@ -347,13 +338,10 @@ module.exports = function (grunt) {
'watch'
]);
});

grunt.registerTask('server', function () {
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
grunt.task.run(['serve']);
});


grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
Expand All @@ -366,9 +354,11 @@ module.exports = function (grunt) {
//'rev',
'usemin'
]);

grunt.registerTask('default', [
'newer:jshint',
'build'
]);
grunt.registerTask('jasmine-build', [
'jasmine:pivotal:build'
]);
};
5 changes: 0 additions & 5 deletions book/bower_components/jquery/test/xhtml.php

This file was deleted.

3 changes: 2 additions & 1 deletion book/index.html
Expand Up @@ -47,7 +47,7 @@ <h2 class="booktitle edition">Volume 1.6.2</h2>
</p>
<p class="copyright"><em>Learning JavaScript Design Patterns</em> is released under a <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-Noncommercial-No Derivative Works 3.0</a> unported license. It is available for purchase via <a href="http://shop.oreilly.com/product/0636920025832.do">O'Reilly</a> Media but will remain available for both free online and as a physical (or eBook) purchase for readers wishing to support the project.</p>

<p><img src="../cover/cover.jpg" width="300px" alt="Book cover for Learning JavaScript Design Patterns"></p>
<p><img src="https://raw.github.com/addyosmani/essential-js-design-patterns/master/cover/cover.jpg" width="300px" alt="Book cover for Learning JavaScript Design Patterns"></p>

<p class="copyright">&nbsp;</p>

Expand Down Expand Up @@ -8999,5 +8999,6 @@ <h1 id="references"><span id="internal-source-marker_0.05095413855216446">Refere
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-46754295-1');ga('send','pageview');
</script>
<script src="//127.0.0.1:35729/livereload.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions package.json
Expand Up @@ -31,15 +31,22 @@
"grunt-contrib-cssmin": "^0.11.0",
"grunt-contrib-htmlmin": "~0.3.0",
"grunt-contrib-imagemin": "^0.9.2",
"grunt-contrib-jasmine": "^0.8.2",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-karma": "^0.11.0",
"grunt-mocha": "~0.4.0",
"grunt-newer": "^0.8.0",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"jasmine-core": "^2.3.4",
"jshint-stylish": "^1.0.0",
"karma": "^0.12.36",
"karma-chrome-launcher": "^0.1.12",
"karma-jasmine": "^0.3.5",
"karma-qunit": "^0.1.4",
"load-grunt-tasks": "^2.0.0",
"time-grunt": "~1.0.0"
},
Expand Down