Skip to content

Commit

Permalink
Merge pull request #311 from alphagov/add-test-for-procfile
Browse files Browse the repository at this point in the history
Reorder grunt tasks, remove the Procfile, remove grunt-shell dependency
  • Loading branch information
robinwhittleton authored Sep 19, 2016
2 parents 447f468 + 38b1f24 commit b460612
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 65 deletions.
81 changes: 18 additions & 63 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ module.exports = function (grunt) {
logConcurrentOutput: true
}
}
},

// Lint scss files
shell: {
multiple: {
command: [
'bundle',
'bundle exec govuk-lint-sass public/sass/elements/'
].join('&&')
}
}

})
Expand All @@ -132,66 +122,31 @@ module.exports = function (grunt) {
'grunt-sass',
'grunt-nodemon',
'grunt-concurrent',
'grunt-shell',
'grunt-htmlentities'
].forEach(function (task) {
grunt.loadNpmTasks(task)
})

grunt.registerTask('default', [
'clean',
'copy',
'encode_snippets',
'sass',
'concurrent:target'
])

grunt.registerTask(
'test_default',
'Test that the default task runs the app',
[
'copy',
'sass'
]
)
grunt.registerTask('default', ['clean', 'copy', 'encode-snippets', 'sass', 'concurrent:target'])

grunt.registerTask(
'encode_snippets',
'Encode HTML snippets',
function () {
grunt.task.run('htmlentities')
}
)

grunt.registerTask(
'lint',
'Use govuk-scss-lint to lint the sass files',
function () {
grunt.task.run('shell', 'lint_message')
}
)
// Encode HTML snippets
grunt.registerTask('encode-snippets', ['htmlentities', 'encode-snippets-success'])
grunt.registerTask('encode-snippets-success', function () {
grunt.log.writeln('HTML snippets encoded.'['yellow'].bold)
})

grunt.registerTask(
'lint_message',
'Output a message once linting is complete',
function () {
grunt.log.write('scss lint is complete, without errors.')
}
)
// Tests
grunt.registerTask('test', ['lint', 'test-default', 'test-success'])
grunt.registerTask('test-success', function () {
grunt.log.writeln('The tests are complete and the app runs, without errors.'['yellow'].bold)
})

grunt.registerTask(
'test',
'Lint the Sass files, then check the app runs',
function () {
grunt.task.run('lint', 'test_default', 'test_message')
}
)
// 1. Use govuk-scss-lint to lint the sass files
grunt.registerTask('lint', ['lint-success'])
grunt.registerTask('lint-success', function () {
grunt.log.writeln('Scss lint is complete, without errors.'['yellow'].bold)
})

grunt.registerTask(
'test_message',
'Output a message once the tests are complete',
function () {
grunt.log.write('scss lint is complete and the app runs, without errors.')
}
)
// 2. Test that the default grunt task runs the app
grunt.registerTask('test-default', ['clean', 'copy', 'encode-snippets', 'sass'])
}
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"standard": "^7.1.2"
},
"scripts": {
"test": "standard && grunt test",
"test": "standard && grunt test && npm run lint --silent",
"lint": "bundle && bundle exec govuk-lint-sass public/sass/elements/",
"start": "grunt"
},
"standard": {
Expand Down

0 comments on commit b460612

Please sign in to comment.