Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Adds support for re-running server and client tests automatically
Browse files Browse the repository at this point in the history
Adds two more tasks to execute server and client tests separately

To run full suite
grunt test

To run only server tests
grunt test:server

To run only client tests
grunt test:client

Fixes #155
  • Loading branch information
miguelcoba committed Jan 24, 2015
1 parent 7b7b73d commit 6bc36ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,27 @@ Your application should run on port 3000, so in your browser just go to [http://
That's it! Your application should be running. To proceed with your development, check the other sections in this documentation.
If you encounter any problems, try the Troubleshooting section.

## Testing Your Application
You can run the full test suite included with MEAN.JS with the test task:

```
$ grunt test
```

This will run both the server-side tests (located in the app/tests/ directory) and the client-side tests (located in the public/modules/*/tests/).

To execute only the server tests, run the test:server task:

```
$ grunt test:server
```

And to run only the client tests, run the test:client task:

```
$ grunt test:client
```

## Development and deployment With Docker

* Install [Docker](http://www.docker.com/)
Expand Down
12 changes: 9 additions & 3 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
serverViews: ['app/views/**/*.*'],
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', '!app/tests/'],
clientViews: ['public/modules/**/views/**/*.html'],
clientJS: ['public/js/*.js', 'public/modules/**/*.js'],
clientCSS: ['public/modules/**/*.css'],
Expand Down Expand Up @@ -47,6 +47,10 @@ module.exports = function(grunt) {
options: {
livereload: true
}
},
mochaTests: {
files: watchFiles.mochaTests,
tasks: ['test:server'],
}
},
jshint: {
Expand Down Expand Up @@ -173,5 +177,7 @@ module.exports = function(grunt) {
grunt.registerTask('build', ['lint', 'loadConfig', 'ngAnnotate', 'uglify', 'cssmin']);

// Test task.
grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
};
grunt.registerTask('test', ['test:server', 'test:client']);
grunt.registerTask('test:server', ['env:test', 'mochaTest']);
grunt.registerTask('test:client', ['env:test', 'karma:unit']);
};

0 comments on commit 6bc36ed

Please sign in to comment.