Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
726a85c7
Commit
726a85c7
authored
Jul 17, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #409 from edx/cale/make-jasmine-tests-quieter
Make jasmine tests quieter
parents
6dda90f6
22302e3a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
.gitignore
+1
-0
rakelib/helpers.rb
+11
-4
rakelib/jasmine.rake
+9
-4
No files found.
.gitignore
View file @
726a85c7
...
@@ -45,3 +45,4 @@ node_modules
...
@@ -45,3 +45,4 @@ node_modules
autodeploy.properties
autodeploy.properties
.ws_migrations_complete
.ws_migrations_complete
.vagrant/
.vagrant/
logs
rakelib/helpers.rb
View file @
726a85c7
...
@@ -52,8 +52,14 @@ end
...
@@ -52,8 +52,14 @@ end
# Runs Process.spawn, and kills the process at the end of the rake process
# Runs Process.spawn, and kills the process at the end of the rake process
# Expects the same arguments as Process.spawn
# Expects the same arguments as Process.spawn
def
background_process
(
*
command
)
def
background_process
(
command
,
logfile
=
nil
)
pid
=
Process
.
spawn
({},
*
command
,
{
:pgroup
=>
true
})
spawn_opts
=
{
:pgroup
=>
true
}
if
!
logfile
.
nil?
puts
"Running '
#{
command
.
join
(
' '
)
}
', redirecting output to
#{
logfile
}
"
.
red
spawn_opts
[[
:err
,
:out
]]
=
[
logfile
,
'a'
]
end
pid
=
Process
.
spawn
({},
*
command
,
spawn_opts
)
command
=
[
*
command
]
at_exit
do
at_exit
do
puts
"Ending process and children"
puts
"Ending process and children"
...
@@ -88,9 +94,10 @@ end
...
@@ -88,9 +94,10 @@ end
# Runs a command as a background process, as long as no other processes
# Runs a command as a background process, as long as no other processes
# tagged with the same tag are running
# tagged with the same tag are running
def
singleton_process
(
*
command
)
def
singleton_process
(
command
,
logfile
=
nil
)
command
=
[
*
command
]
if
Sys
::
ProcTable
.
ps
.
select
{
|
proc
|
proc
.
cmdline
.
include?
(
command
.
join
(
' '
))}.
empty?
if
Sys
::
ProcTable
.
ps
.
select
{
|
proc
|
proc
.
cmdline
.
include?
(
command
.
join
(
' '
))}.
empty?
background_process
(
*
command
)
background_process
(
command
,
logfile
)
else
else
puts
"Process '
#{
command
.
join
(
' '
)
}
already running, skipping"
.
blue
puts
"Process '
#{
command
.
join
(
' '
)
}
already running, skipping"
.
blue
end
end
...
...
rakelib/jasmine.rake
View file @
726a85c7
...
@@ -8,6 +8,11 @@ PREFERRED_METHOD = PHANTOMJS_PATH.nil? ? 'browser' : 'phantomjs'
...
@@ -8,6 +8,11 @@ PREFERRED_METHOD = PHANTOMJS_PATH.nil? ? 'browser' : 'phantomjs'
if
PHANTOMJS_PATH
.
nil?
if
PHANTOMJS_PATH
.
nil?
puts
(
"phantomjs not found on path. Set $PHANTOMJS_PATH. Using browser for jasmine tests"
.
blue
)
puts
(
"phantomjs not found on path. Set $PHANTOMJS_PATH. Using browser for jasmine tests"
.
blue
)
end
end
LOGDIR
=
'logs/jasmine'
CLOBBER
.
include
(
LOGDIR
)
directory
LOGDIR
def
django_for_jasmine
(
system
,
django_reload
)
def
django_for_jasmine
(
system
,
django_reload
)
if
!
django_reload
if
!
django_reload
...
@@ -17,7 +22,7 @@ def django_for_jasmine(system, django_reload)
...
@@ -17,7 +22,7 @@ def django_for_jasmine(system, django_reload)
port
=
10000
+
rand
(
40000
)
port
=
10000
+
rand
(
40000
)
jasmine_url
=
"http://localhost:
#{
port
}
/_jasmine/"
jasmine_url
=
"http://localhost:
#{
port
}
/_jasmine/"
background_process
(
*
django_admin
(
system
,
'jasmine'
,
'runserver'
,
'-v'
,
'0'
,
port
.
to_s
,
reload_arg
).
split
(
' '
)
)
background_process
(
django_admin
(
system
,
'jasmine'
,
'runserver'
,
'-v'
,
'0'
,
port
.
to_s
,
reload_arg
).
split
(
' '
),
"
#{
LOGDIR
}
/django.log"
)
up
=
false
up
=
false
start_time
=
Time
.
now
start_time
=
Time
.
now
...
@@ -80,7 +85,7 @@ end
...
@@ -80,7 +85,7 @@ end
namespace
:jasmine
do
namespace
:jasmine
do
namespace
system
do
namespace
system
do
desc
"Open jasmine tests for
#{
system
}
in your default browser"
desc
"Open jasmine tests for
#{
system
}
in your default browser"
task
:browser
=>
[
:clean_reports_dir
]
do
task
:browser
=>
[
:clean_reports_dir
,
LOGDIR
]
do
Rake
::
Task
[
:assets
].
invoke
(
system
,
'jasmine'
)
Rake
::
Task
[
:assets
].
invoke
(
system
,
'jasmine'
)
django_for_jasmine
(
system
,
true
)
do
|
jasmine_url
|
django_for_jasmine
(
system
,
true
)
do
|
jasmine_url
|
jasmine_browser
(
jasmine_url
)
jasmine_browser
(
jasmine_url
)
...
@@ -88,7 +93,7 @@ end
...
@@ -88,7 +93,7 @@ end
end
end
desc
"Open jasmine tests for
#{
system
}
in your default browser, and dynamically recompile coffeescript"
desc
"Open jasmine tests for
#{
system
}
in your default browser, and dynamically recompile coffeescript"
task
:'browser:watch'
=>
[
:clean_reports_dir
,
:'assets:coffee:_watch'
]
do
task
:'browser:watch'
=>
[
:clean_reports_dir
,
:'assets:coffee:_watch'
,
LOGDIR
]
do
django_for_jasmine
(
system
,
true
)
do
|
jasmine_url
|
django_for_jasmine
(
system
,
true
)
do
|
jasmine_url
|
jasmine_browser
(
jasmine_url
,
jitter
=
0
,
wait
=
0
)
jasmine_browser
(
jasmine_url
,
jitter
=
0
,
wait
=
0
)
end
end
...
@@ -97,7 +102,7 @@ end
...
@@ -97,7 +102,7 @@ end
end
end
desc
"Use phantomjs to run jasmine tests for
#{
system
}
from the console"
desc
"Use phantomjs to run jasmine tests for
#{
system
}
from the console"
task
:phantomjs
=>
[
:clean_reports_dir
]
do
task
:phantomjs
=>
[
:clean_reports_dir
,
LOGDIR
]
do
Rake
::
Task
[
:assets
].
invoke
(
system
,
'jasmine'
)
Rake
::
Task
[
:assets
].
invoke
(
system
,
'jasmine'
)
phantomjs
=
ENV
[
'PHANTOMJS_PATH'
]
||
'phantomjs'
phantomjs
=
ENV
[
'PHANTOMJS_PATH'
]
||
'phantomjs'
django_for_jasmine
(
system
,
false
)
do
|
jasmine_url
|
django_for_jasmine
(
system
,
false
)
do
|
jasmine_url
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment