@@ -810,7 +810,7 @@ var _ = require('lodash'),
810
810
grunt . log . write ( 'no test provided' ) ;
811
811
}
812
812
813
- grunt . task . run ( 'setTestEnv ' , 'shell:test:' + test ) ;
813
+ grunt . task . run ( 'test-setup ' , 'shell:test:' + test ) ;
814
814
} ) ;
815
815
816
816
// ### Validate
@@ -825,21 +825,30 @@ var _ = require('lodash'),
825
825
grunt . registerTask ( 'validate' , 'Run tests and lint code' ,
826
826
[ 'init' , 'test-all' ] ) ;
827
827
828
- // ### Test
828
+ // ### Test-All
829
829
// **Main testing task**
830
830
//
831
- // `grunt test` will lint and test your pre-built local Ghost codebase.
831
+ // `grunt test-all ` will lint and test your pre-built local Ghost codebase.
832
832
//
833
- // `grunt test` runs jshint and jscs as well as the 4 test suites. See the individual sub tasks below for
833
+ // `grunt test-all ` runs jshint and jscs as well as all 6 test suites. See the individual sub tasks below for
834
834
// details of each of the test suites.
835
835
//
836
836
grunt . registerTask ( 'test-all' , 'Run tests and lint code' ,
837
- [ 'jshint' , 'jscs' , 'test-routes' , 'test-module' , 'test-unit' , 'test-integration' , 'test-functional' , 'shell:testem' ] ) ;
837
+ [ 'lint' , 'test-routes' , 'test-module' , 'test-unit' , 'test-integration' , 'test-functional' , 'shell:testem' ]
838
+ ) ;
838
839
839
840
// ### Lint
840
841
//
841
842
// `grunt lint` will run the linter and the code style checker so you can make sure your code is pretty
842
- grunt . registerTask ( 'lint' , 'Run the code style checks and linter' , [ 'jshint' , 'jscs' ] ) ;
843
+ grunt . registerTask ( 'lint' , 'Run the code style checks and linter' ,
844
+ [ 'jshint' , 'jscs' ]
845
+ ) ;
846
+
847
+ // ### test-setup *(utility)(
848
+ // `grunt test-setup` will run all the setup tasks required for running tests
849
+ grunt . registerTask ( 'test-setup' , 'Setup ready to run tests' ,
850
+ [ 'clean:test' , 'setTestEnv' , 'ensureConfig' ]
851
+ ) ;
843
852
844
853
// ### Unit Tests *(sub task)*
845
854
// `grunt test-unit` will run just the unit tests
@@ -859,7 +868,8 @@ var _ = require('lodash'),
859
868
// Unit tests do **not** touch the database.
860
869
// A coverage report can be generated for these tests using the `grunt test-coverage` task.
861
870
grunt . registerTask ( 'test-unit' , 'Run unit tests (mocha)' ,
862
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'mochacli:unit' ] ) ;
871
+ [ 'test-setup' , 'mochacli:unit' ]
872
+ ) ;
863
873
864
874
// ### Integration tests *(sub task)*
865
875
// `grunt test-integration` will run just the integration tests
@@ -888,7 +898,8 @@ var _ = require('lodash'),
888
898
//
889
899
// A coverage report can be generated for these tests using the `grunt test-coverage` task.
890
900
grunt . registerTask ( 'test-integration' , 'Run integration tests (mocha + db access)' ,
891
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'mochacli:integration' ] ) ;
901
+ [ 'test-setup' , 'mochacli:integration' ]
902
+ ) ;
892
903
893
904
// ### Route tests *(sub task)*
894
905
// `grunt test-routes` will run just the route tests
@@ -909,24 +920,22 @@ var _ = require('lodash'),
909
920
// are working as expected, including checking the headers and status codes received. It is very easy and
910
921
// quick to test many permutations of routes / urls in the system.
911
922
grunt . registerTask ( 'test-routes' , 'Run functional route tests (mocha)' ,
912
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'mochacli:routes' ] ) ;
923
+ [ 'test-setup' , 'mochacli:routes' ]
924
+ ) ;
913
925
914
926
// ### Module tests *(sub task)*
915
927
// `grunt test-module` will run just the module tests
916
928
//
917
929
// The purpose of the module tests is to ensure that Ghost can be used as an npm module and exposes all
918
930
// required methods to interact with it.
919
931
grunt . registerTask ( 'test-module' , 'Run functional module tests (mocha)' ,
920
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'mochacli:module' ] ) ;
932
+ [ 'test-setup' , 'mochacli:module' ]
933
+ ) ;
921
934
922
- // ### Functional tests for the setup process
923
- // `grunt test-functional-setup will run just the functional tests for the setup page.
924
- //
925
- // Setup only works with a brand new database, so it needs to run isolated from the rest of
926
- // the functional tests.
927
- grunt . registerTask ( 'test-functional-setup' , 'Run functional tests for setup' ,
928
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'cleanDatabase' , 'express:test' ,
929
- 'spawnCasperJS:setup' , 'express:test:stop' ]
935
+ // ### Ember unit tests *(sub task)*
936
+ // `grunt testem` will run just the ember unit tests
937
+ grunt . registerTask ( 'testem' , 'Run the ember unit tests' ,
938
+ [ 'test-setup' , 'shell:testem' ]
930
939
) ;
931
940
932
941
// ### Functional tests *(sub task)*
@@ -948,8 +957,16 @@ var _ = require('lodash'),
948
957
// The purpose of the functional tests is to ensure that Ghost is working as is expected from a user perspective
949
958
// including buttons and other important interactions in the admin UI.
950
959
grunt . registerTask ( 'test-functional' , 'Run functional interface tests (CasperJS)' ,
951
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'cleanDatabase' , 'express:test' , 'spawnCasperJS' , 'express:test:stop' ,
952
- 'test-functional-setup' ]
960
+ [ 'test-setup' , 'cleanDatabase' , 'express:test' , 'spawnCasperJS' , 'express:test:stop' , 'test-functional-setup' ]
961
+ ) ;
962
+
963
+ // ### Functional tests for the setup process
964
+ // `grunt test-functional-setup will run just the functional tests for the setup page.
965
+ //
966
+ // Setup only works with a brand new database, so it needs to run isolated from the rest of
967
+ // the functional tests.
968
+ grunt . registerTask ( 'test-functional-setup' , 'Run functional tests for setup' ,
969
+ [ 'test-setup' , 'cleanDatabase' , 'express:test' , 'spawnCasperJS:setup' , 'express:test:stop' ]
953
970
) ;
954
971
955
972
// ### Coverage
@@ -962,7 +979,8 @@ var _ = require('lodash'),
962
979
//
963
980
// Key areas for coverage are: helpers and theme elements, apps / GDK, the api and model layers.
964
981
grunt . registerTask ( 'test-coverage' , 'Generate unit and integration (mocha) tests coverage report' ,
965
- [ 'clean:test' , 'setTestEnv' , 'ensureConfig' , 'shell:coverage' ] ) ;
982
+ [ 'test-setup' , 'shell:coverage' ]
983
+ ) ;
966
984
967
985
// ## Building assets
968
986
//
0 commit comments