Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Add mocha tests to app generator
Browse files Browse the repository at this point in the history
  • Loading branch information
robdodson committed Sep 12, 2014
1 parent d48160a commit f9e168c
Show file tree
Hide file tree
Showing 17 changed files with 148 additions and 9,473 deletions.
1 change: 1 addition & 0 deletions app/index.js
Expand Up @@ -94,5 +94,6 @@ module.exports = yeoman.generators.Base.extend({
this.includeSass ? 'app/elements/yo-greeting/yo-greeting.scss':
'app/elements/yo-greeting/yo-greeting.css');
this.copy('app/index.html', 'app/index.html');
this.directory('test', 'app/test');
}
});
45 changes: 9 additions & 36 deletions app/templates/Gruntfile.js
Expand Up @@ -53,11 +53,7 @@ module.exports = function (grunt) {
'<%%= yeoman.app %>/elements/{,*/}*.css'
],
tasks: ['copy:styles', 'autoprefixer:server']
}<% if (testFramework === 'jasmine') { %>,
test: {
files: ['<%%= yeoman.app %>/scripts/{,*/}*.js', 'test/spec/**/*.js'],
tasks: ['test']
}<% } %><% if (includeSass) { %>,
}<% if (includeSass) { %>,
sass: {
files: [
'<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}',
Expand Down Expand Up @@ -137,13 +133,15 @@ module.exports = function (grunt) {
},
test: {
options: {
open: {
target: 'http://localhost:<%%= connect.options.port %>/test/runner.html'
},
middleware: function (connect) {
return [
mountFolder(connect, '.tmp'),
mountFolder(connect, 'test'),
mountFolder(connect, yeomanConfig.app)
];
}
},
keepalive: true
}
},
dist: {
Expand Down Expand Up @@ -175,29 +173,7 @@ module.exports = function (grunt) {
'!<%%= yeoman.app %>/scripts/vendor/*',
'test/spec/{,*/}*.js'
]
}<% if (testFramework === 'mocha') { %>,
mocha: {
all: {
options: {
run: true,
urls: ['http://localhost:<%%= connect.options.port %>/index.html']
}
}
}<% } else { %>,
jasmine: {
all:{
src : '.tmp/scripts/combined-scripts.js',
options: {
keepRunner: true,
specs : 'test/spec/**/*.js',
vendor : [
'<%%= yeoman.app %>/bower_components/jquery/jquery.js',
'<%%= yeoman.app %>/bower_components/underscore/underscore.js',
'<%%= yeoman.app %>/bower_components/backbone/backbone.js'
]
}
}
}<% } %>,
},
useminPrepare: {
html: '<%%= yeoman.app %>/index.html',
options: {
Expand Down Expand Up @@ -341,11 +317,8 @@ module.exports = function (grunt) {
});

grunt.registerTask('test', [
'clean:server',<% if(testFramework === 'mocha') { %>
'connect:test',
'mocha'<% } else { %>
'jasmine',
'watch:test'<% } %>
'clean:server',
'connect:test'
]);

grunt.registerTask('build', [
Expand Down
4 changes: 3 additions & 1 deletion app/templates/_bower.json
Expand Up @@ -6,5 +6,7 @@
"paper-elements": "Polymer/paper-elements#^0.4.0",<% } %>
"polymer": "Polymer/polymer#^0.4.0"
},
"devDependencies": {}
"devDependencies": {
"polymer-test-tools": "Polymer/polymer-test-tools#^0.4.0"
}
}
4 changes: 1 addition & 3 deletions app/templates/_package.json
Expand Up @@ -16,9 +16,7 @@
"grunt-contrib-connect": "0.8.0",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-imagemin": "0.7.1",
"grunt-contrib-watch": "~0.6.1",<% if (testFramework === 'jasmine') { %>
"grunt-contrib-jasmine": "~0.5.1",<% } else { %>
"grunt-mocha": "~0.4.7",<% } %>
"grunt-contrib-watch": "~0.6.1",
"grunt-usemin": "~2.3.0",
"grunt-pagespeed": "~0.3.0",
"grunt-rev": "~0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/app/yo-greeting.html
@@ -1,6 +1,6 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">

<polymer-element name="yo-greeting" attributes="">
<polymer-element name="yo-greeting" attributes="">
<template>
<link rel="stylesheet" href="yo-greeting.css">
<h1>{{ greeting }}, {{ greeting }}!</h1>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/app/yo-list.html
@@ -1,6 +1,6 @@
<link rel="import" href="../../bower_components/polymer/polymer.html">

<polymer-element name="yo-list" attributes="">
<polymer-element name="yo-list" attributes="">
<template>
<link rel="stylesheet" href="yo-list.css">
<ul>
Expand Down
47 changes: 0 additions & 47 deletions app/templates/test/index.html

This file was deleted.

0 comments on commit f9e168c

Please sign in to comment.