Change tests_enabled to environment variable.

This commit is contained in:
ccd0 2016-04-10 03:16:43 -07:00
parent da08e6dc2e
commit 14f32a7dec
6 changed files with 7 additions and 20 deletions

View File

@ -85,7 +85,7 @@ module.exports = (grunt) ->
""".split('\n').join('&&')
crx:
command: """
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee type=crx tests_enabled=<%= pkg.tests_enabled || "" %>
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-crx.coffee type=crx
<%= BIN %>coffee --no-header -c tmp/script-crx.coffee
<%= BIN %>coffee --no-header -o tmp -c src/General/eventPage.coffee
<%= BIN %>jshint tmp/script-crx.js tmp/eventPage.js
@ -102,7 +102,7 @@ module.exports = (grunt) ->
command: 'node tools/cp.js testbuilds/<%= pkg.name %>-noupdate.crx.zip testbuilds/<%= pkg.name %>.zip'
userscript:
command: """
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee type=userscript tests_enabled=<%= pkg.tests_enabled || "" %>
<%= BIN %>coffee tools/templates.coffee tmp/script.coffee tmp/script-userscript.coffee type=userscript
<%= BIN %>coffee --no-header -c tmp/script-userscript.coffee
<%= BIN %>jshint tmp/script-userscript.js
""".split('\n').join('&&')
@ -198,11 +198,6 @@ module.exports = (grunt) ->
pkg.channel = channel
grunt.config 'pkg', pkg
grunt.registerTask 'enable-tests', 'Include testing code', () ->
pkg = grunt.config 'pkg'
pkg.tests_enabled = true
grunt.config 'pkg', pkg
grunt.registerTask 'build', [
'shell:npm'
'shell:general'
@ -264,14 +259,6 @@ module.exports = (grunt) ->
'shell:install'
]
grunt.registerTask 'build-tests', [
'shell:npm'
'enable-tests'
'shell:general'
'build-crx'
'build-userscript'
]
grunt.registerTask 'clean', [
'shell:clean'
]

View File

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

View File

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

View File

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

View File

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

View File

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