Store tests_enabled flag in file.

This commit is contained in:
ccd0 2016-04-10 20:00:48 -07:00
parent 550d33bc0f
commit b746a0b054
8 changed files with 19 additions and 5 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@ captchas.html
install.json install.json
Gruntfile.js Gruntfile.js
.jshintrc .jshintrc
.tests_enabled

View File

@ -76,6 +76,10 @@ module.exports = (grunt) ->
failOnError: true failOnError: true
clean: clean:
command: 'node tools/clean.js' command: 'node tools/clean.js'
'tests-false':
command: 'echo false> .tests_enabled'
'tests-true':
command: 'echo true> .tests_enabled'
general: general:
command: """ command: """
<%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc <%= BIN %>coffee tools/templates.coffee src/meta/jshint.json .jshintrc
@ -205,6 +209,14 @@ module.exports = (grunt) ->
grunt.registerTask 'build', [ grunt.registerTask 'build', [
'shell:npm' 'shell:npm'
'shell:tests-false'
'shell:general'
'concurrent:build'
]
grunt.registerTask 'build-tests', [
'shell:npm'
'shell:tests-true'
'shell:general' 'shell:general'
'concurrent:build' 'concurrent:build'
] ]

View File

@ -1,4 +1,4 @@
<% if (process.env.tests_enabled) { %> <% if (grunt.file.readJSON('.tests_enabled')) { %>
BuildTest = BuildTest =
init: -> init: ->
return if !Conf['Menu'] or g.VIEW not in ['index', 'thread'] return if !Conf['Menu'] or g.VIEW not in ['index', 'thread']

View File

@ -469,7 +469,7 @@ Main =
['Banner', Banner] ['Banner', Banner]
['Flash Features', Flash] ['Flash Features', Flash]
['Reply Pruning', ReplyPruning] ['Reply Pruning', ReplyPruning]
<% if (process.env.tests_enabled) { %> <% if (grunt.file.readJSON('.tests_enabled')) { %>
['Build Test', BuildTest] ['Build Test', BuildTest]
<% } %> <% } %>
] ]

View File

@ -192,7 +192,7 @@ Keybinds =
when Conf['Next Post Quoting You'] when Conf['Next Post Quoting You']
return unless threadRoot and QuoteYou.db return unless threadRoot and QuoteYou.db
QuoteYou.cb.seek 'following' QuoteYou.cb.seek 'following'
<% if (process.env.tests_enabled) { %> <% if (grunt.file.readJSON('.tests_enabled')) { %>
when 't' when 't'
return unless threadRoot return unless threadRoot
BuildTest.testAll() BuildTest.testAll()

View File

@ -28,7 +28,7 @@ Unread =
name: 'Unread' name: 'Unread'
cb: @addPost cb: @addPost
<% if (process.env.tests_enabled) { %> <% if (grunt.file.readJSON('.tests_enabled')) { %>
testLink = $.el 'a', testLink = $.el 'a',
textContent: 'Test Post Order' textContent: 'Test Post Order'
$.on testLink, 'click', -> $.on testLink, 'click', ->

View File

@ -3,7 +3,7 @@ class Post
toString: -> @ID toString: -> @ID
constructor: (root, @thread, @board) -> constructor: (root, @thread, @board) ->
<% if (process.env.tests_enabled) { %> <% if (grunt.file.readJSON('.tests_enabled')) { %>
root2 = root.cloneNode true root2 = root.cloneNode true
for el in $$ '.mobile', root2 for el in $$ '.mobile', root2
$.rm el $.rm el

View File

@ -4,3 +4,4 @@ fs.removeSync('tmp');
fs.removeSync('testbuilds'); fs.removeSync('testbuilds');
fs.removeSync('builds'); fs.removeSync('builds');
fs.removeSync('.jshintrc'); fs.removeSync('.jshintrc');
fs.removeSync('.tests_enabled');