diff --git a/.gitignore b/.gitignore index a5d6759e4..b3ac96741 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ captchas.html install.json Gruntfile.js .jshintrc +.tests_enabled diff --git a/Gruntfile.coffee b/Gruntfile.coffee index e1658b7ce..b57ef0854 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -76,6 +76,10 @@ module.exports = (grunt) -> failOnError: true clean: command: 'node tools/clean.js' + 'tests-false': + command: 'echo false> .tests_enabled' + 'tests-true': + command: 'echo true> .tests_enabled' general: command: """ <%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc @@ -205,6 +209,14 @@ module.exports = (grunt) -> grunt.registerTask 'build', [ 'shell:npm' + 'shell:tests-false' + 'shell:general' + 'concurrent:build' + ] + + grunt.registerTask 'build-tests', [ + 'shell:npm' + 'shell:tests-true' 'shell:general' 'concurrent:build' ] diff --git a/src/General/BuildTest.coffee b/src/General/BuildTest.coffee index 93b0fdc35..4fb1e7957 100644 --- a/src/General/BuildTest.coffee +++ b/src/General/BuildTest.coffee @@ -1,4 +1,4 @@ -<% if (process.env.tests_enabled) { %> +<% if (grunt.file.readJSON('.tests_enabled')) { %> BuildTest = init: -> return if !Conf['Menu'] or g.VIEW not in ['index', 'thread'] diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 0eb4e6f9c..a6052b506 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -469,7 +469,7 @@ Main = ['Banner', Banner] ['Flash Features', Flash] ['Reply Pruning', ReplyPruning] - <% if (process.env.tests_enabled) { %> + <% if (grunt.file.readJSON('.tests_enabled')) { %> ['Build Test', BuildTest] <% } %> ] diff --git a/src/Miscellaneous/Keybinds.coffee b/src/Miscellaneous/Keybinds.coffee index d3de5ffa8..63518416b 100644 --- a/src/Miscellaneous/Keybinds.coffee +++ b/src/Miscellaneous/Keybinds.coffee @@ -192,7 +192,7 @@ Keybinds = when Conf['Next Post Quoting You'] return unless threadRoot and QuoteYou.db QuoteYou.cb.seek 'following' - <% if (process.env.tests_enabled) { %> + <% if (grunt.file.readJSON('.tests_enabled')) { %> when 't' return unless threadRoot BuildTest.testAll() diff --git a/src/Monitoring/Unread.coffee b/src/Monitoring/Unread.coffee index 00dd6944c..575667b54 100644 --- a/src/Monitoring/Unread.coffee +++ b/src/Monitoring/Unread.coffee @@ -28,7 +28,7 @@ Unread = name: 'Unread' cb: @addPost - <% if (process.env.tests_enabled) { %> + <% if (grunt.file.readJSON('.tests_enabled')) { %> testLink = $.el 'a', textContent: 'Test Post Order' $.on testLink, 'click', -> diff --git a/src/classes/Post.coffee b/src/classes/Post.coffee index 8018751df..6a2d5f96a 100644 --- a/src/classes/Post.coffee +++ b/src/classes/Post.coffee @@ -3,7 +3,7 @@ class Post toString: -> @ID constructor: (root, @thread, @board) -> - <% if (process.env.tests_enabled) { %> + <% if (grunt.file.readJSON('.tests_enabled')) { %> root2 = root.cloneNode true for el in $$ '.mobile', root2 $.rm el diff --git a/tools/clean.js b/tools/clean.js index ac20b3ef8..1993941f6 100644 --- a/tools/clean.js +++ b/tools/clean.js @@ -4,3 +4,4 @@ fs.removeSync('tmp'); fs.removeSync('testbuilds'); fs.removeSync('builds'); fs.removeSync('.jshintrc'); +fs.removeSync('.tests_enabled');