2014-02-12 05:40:42 -05:00
module.exports = (grunt) ->
grunt . initConfig
2014-02-26 11:54:35 -05:00
forever:
app:
options:
index: " app.js "
2014-02-12 05:40:42 -05:00
execute:
app:
src: " app.js "
bunyan:
strict: false
coffee:
2016-07-18 06:09:04 -04:00
app_dir:
2014-02-12 05:40:42 -05:00
expand: true ,
flatten: false ,
cwd: ' app/coffee ' ,
src: [ ' **/*.coffee ' ] ,
dest: ' app/js/ ' ,
ext: ' .js '
2016-07-18 06:09:04 -04:00
app:
2014-02-12 05:40:42 -05:00
src: ' app.coffee '
dest: ' app.js '
acceptance_tests:
expand: true ,
flatten: false ,
cwd: ' test/acceptance/coffee ' ,
src: [ ' **/*.coffee ' ] ,
dest: ' test/acceptance/js/ ' ,
ext: ' .js '
2016-07-18 06:09:04 -04:00
unit_tests:
2014-02-12 05:40:42 -05:00
expand: true ,
flatten: false ,
cwd: ' test/unit/coffee ' ,
src: [ ' **/*.coffee ' ] ,
dest: ' test/unit/js/ ' ,
ext: ' .js '
clean:
app: [ " app/js " ]
2014-02-26 10:56:52 -05:00
acceptance_tests: [ " test/acceptance/js " ]
2014-05-14 08:28:17 -04:00
unit_tests: [ " test/unit/js " ]
2014-02-12 05:40:42 -05:00
mochaTest:
unit:
2014-02-26 10:56:52 -05:00
src: [ " test/unit/js/ #{ grunt . option ( ' feature ' ) or ' ** ' } /*.js " ]
2014-02-12 05:40:42 -05:00
options:
reporter: grunt . option ( ' reporter ' ) or ' spec '
grep: grunt . option ( " grep " )
acceptance:
2014-02-26 10:56:52 -05:00
src: [ " test/acceptance/js/ #{ grunt . option ( ' feature ' ) or ' * ' } .js " ]
2014-02-12 05:40:42 -05:00
options:
reporter: grunt . option ( ' reporter ' ) or ' spec '
grep: grunt . option ( " grep " )
2017-07-17 06:13:21 -04:00
timeout: 50000
2014-02-12 05:40:42 -05:00
2016-07-08 07:09:01 -04:00
shell:
fullAcceptanceTests:
command: " bash ./test/acceptance/scripts/full-test.sh "
dockerTests:
2016-07-18 05:36:03 -04:00
command: ' docker run -v " $(pwd):/app " --rm sl-acceptance-test-runner '
2016-07-08 07:09:01 -04:00
2014-02-12 05:40:42 -05:00
availabletasks:
tasks:
options:
filter: ' exclude ' ,
tasks: [
' coffee '
' clean '
' mochaTest '
' availabletasks '
' execute '
' bunyan '
]
groups:
" Compile tasks " : [
" compile:server "
" compile:tests "
" compile "
" compile:unit_tests "
" compile:acceptance_tests "
" install "
]
" Test tasks " : [
" test:unit "
" test:acceptance "
]
" Run tasks " : [
" run "
" default "
]
" Misc " : [
" help "
]
2016-11-29 10:09:11 -05:00
grunt . loadNpmTasks ' grunt-contrib-coffee '
grunt . loadNpmTasks ' grunt-contrib-clean '
grunt . loadNpmTasks ' grunt-mocha-test '
grunt . loadNpmTasks ' grunt-available-tasks '
grunt . loadNpmTasks ' grunt-execute '
grunt . loadNpmTasks ' grunt-bunyan '
grunt . loadNpmTasks ' grunt-forever '
grunt . loadNpmTasks ' grunt-shell '
2014-02-12 05:40:42 -05:00
grunt . registerTask ' help ' , ' Display this help list ' , ' availabletasks '
grunt . registerTask ' compile:server ' , ' Compile the server side coffee script ' , [ ' clean:app ' , ' coffee:app ' , ' coffee:app_dir ' ]
2014-05-14 08:28:17 -04:00
grunt . registerTask ' compile:unit_tests ' , ' Compile the unit tests ' , [ ' clean:unit_tests ' , ' coffee:unit_tests ' ]
2014-02-12 05:40:42 -05:00
grunt . registerTask ' compile:acceptance_tests ' , ' Compile the acceptance tests ' , [ ' clean:acceptance_tests ' , ' coffee:acceptance_tests ' ]
grunt . registerTask ' compile:tests ' , ' Compile all the tests ' , [ ' compile:acceptance_tests ' , ' compile:unit_tests ' ]
grunt . registerTask ' compile ' , ' Compiles everything need to run document-updater-sharelatex ' , [ ' compile:server ' ]
grunt . registerTask ' install ' , " Compile everything when installing as an npm module " , [ ' compile ' ]
2014-02-24 11:52:12 -05:00
grunt . registerTask ' test:unit ' , ' Run the unit tests (use --grep=<regex> for individual tests) ' , [ ' compile:server ' , ' compile:unit_tests ' , ' mochaTest:unit ' ]
2016-07-08 07:09:01 -04:00
grunt . registerTask (
' test:acceptance:full ' ,
" Start server and run acceptance tests " ,
[ ' shell:fullAcceptanceTests ' ]
)
2016-07-18 05:36:03 -04:00
grunt . registerTask (
2016-07-18 06:09:04 -04:00
' test:acceptance:docker ' ,
2016-07-18 05:36:03 -04:00
" Run acceptance tests inside docker container " ,
2016-07-18 06:09:04 -04:00
[ ' shell:dockerTests ' ]
2016-07-18 05:36:03 -04:00
)
2014-02-12 05:40:42 -05:00
grunt . registerTask ' test:acceptance ' , ' Run the acceptance tests (use --grep=<regex> for individual tests) ' , [ ' compile:acceptance_tests ' , ' mochaTest:acceptance ' ]
grunt . registerTask ' run ' , " Compile and run the document-updater-sharelatex server " , [ ' compile ' , ' bunyan ' , ' execute ' ]
grunt . registerTask ' default ' , ' run '