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
684b9850
Commit
684b9850
authored
Oct 30, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make rake commands to run jasmine tests in browser and via phantomjs
parent
763e4722
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
68 deletions
+56
-68
.gitmodules
+3
-0
Gemfile
+2
-0
common/templates/jasmine/base.html
+4
-1
common/test/phantom-jasmine
+1
-0
lms/templates/jasmine/base.html
+0
-67
rakefile
+46
-0
No files found.
.gitmodules
View file @
684b9850
[submodule "common/test/phantom-jasmine"]
path = common/test/phantom-jasmine
url = https://github.com/jcarver989/phantom-jasmine.git
Gemfile
View file @
684b9850
...
...
@@ -3,3 +3,5 @@ ruby "1.9.3"
gem
'
rake
'
gem
'
sass
'
,
'3.1.15'
gem
'
bourbon
'
,
'~> 1.3.6'
gem
'
colorize
'
gem
'
launchy
'
c
ms
/templates/jasmine/base.html
→
c
ommon
/templates/jasmine/base.html
View file @
684b9850
...
...
@@ -11,6 +11,7 @@
<script
src=
"{% static 'jasmine-latest/jasmine.js' %}"
></script>
<script
src=
"{% static 'jasmine-latest/jasmine-html.js' %}"
></script>
<script
src=
"{% static 'js/vendor/jasmine-jquery.js' %}"
></script>
<script
src=
"{% static 'console-runner.js' %}"
></script>
{# source files #}
{% for url in suite.js_files %}
...
...
@@ -19,7 +20,7 @@
{% load compressed %}
{# static files #}
{% compressed_js '
main
' %}
{% compressed_js '
js-test-source
' %}
{# spec files #}
{% compressed_js 'spec' %}
...
...
@@ -31,6 +32,7 @@
<script>
{
%
block
jasmine
%
}
var
console_reporter
=
new
jasmine
.
ConsoleReporter
();
(
function
()
{
var
jasmineEnv
=
jasmine
.
getEnv
();
jasmineEnv
.
updateInterval
=
1000
;
...
...
@@ -38,6 +40,7 @@
var
trivialReporter
=
new
jasmine
.
TrivialReporter
();
jasmineEnv
.
addReporter
(
trivialReporter
);
jasmine
.
getEnv
().
addReporter
(
console_reporter
);
jasmineEnv
.
specFilter
=
function
(
spec
)
{
return
trivialReporter
.
specFilter
(
spec
);
...
...
phantom-jasmine
@
a54d435b
Subproject commit a54d435b5556650efbcdb0490e6c7928ac75238a
lms/templates/jasmine/base.html
deleted
100644 → 0
View file @
763e4722
<!doctype html>
<html>
<head>
<title>
Jasmine Spec Runner
</title>
{% load staticfiles %}
<link
rel=
"stylesheet"
href=
"{% static 'jasmine-latest/jasmine.css' %}"
media=
"screen"
>
{# core files #}
<script
src=
"{% static 'jasmine-latest/jasmine.js' %}"
></script>
<script
src=
"{% static 'jasmine-latest/jasmine-html.js' %}"
></script>
<script
src=
"{% static 'js/vendor/jasmine-jquery.js' %}"
></script>
{# source files #}
{% for url in suite.js_files %}
<script
src=
"{{ url }}"
></script>
{% endfor %}
{% load compressed %}
{# static files #}
{% compressed_js 'application' %}
{% compressed_js 'module-js' %}
{# spec files #}
{% compressed_js 'spec' %}
</head>
<body>
<h1>
Jasmine Spec Runner
</h1>
<script>
{
%
block
jasmine
%
}
(
function
()
{
var
jasmineEnv
=
jasmine
.
getEnv
();
jasmineEnv
.
updateInterval
=
1000
;
var
trivialReporter
=
new
jasmine
.
TrivialReporter
();
jasmineEnv
.
addReporter
(
trivialReporter
);
jasmineEnv
.
specFilter
=
function
(
spec
)
{
return
trivialReporter
.
specFilter
(
spec
);
};
// Additional configuration can be done in this block
{
%
block
jasmine_extra
%
}{
%
endblock
%
}
var
currentWindowOnload
=
window
.
onload
;
window
.
onload
=
function
()
{
if
(
currentWindowOnload
)
{
currentWindowOnload
();
}
execJasmine
();
};
function
execJasmine
()
{
jasmineEnv
.
execute
();
}
})();
{
%
endblock
%
}
</script>
</body>
</html>
rakefile
View file @
684b9850
require
'rake/clean'
require
'tempfile'
require
'net/http'
require
'launchy'
require
'colorize'
# Build Constants
REPO_ROOT
=
File
.
dirname
(
__FILE__
)
...
...
@@ -38,6 +41,32 @@ def django_admin(system, env, command, *args)
return
"
#{
django_admin
}
#{
command
}
--settings=
#{
system
}
.envs.
#{
env
}
--pythonpath=.
#{
args
.
join
(
' '
)
}
"
end
def
django_for_jasmine
(
system
)
django_pid
=
fork
do
exec
(
*
django_admin
(
system
,
'dev'
,
'runserver'
,
'12345'
).
split
(
' '
))
end
puts
django_pid
jasmine_url
=
'http://localhost:12345/_jasmine/'
up
=
false
until
up
do
begin
response
=
Net
::
HTTP
.
get_response
(
URI
(
jasmine_url
))
puts
response
.
code
up
=
response
.
code
==
'200'
rescue
=>
e
puts
e
.
message
ensure
puts
(
'Waiting server to start'
)
sleep
(
0.5
)
end
end
begin
yield
jasmine_url
ensure
Process
.
kill
(
:SIGKILL
,
-
Process
.
getpgid
(
django_pid
))
Process
.
wait
(
django_pid
)
end
end
task
:default
=>
[
:test
,
:pep8
,
:pylint
]
directory
REPORT_DIR
...
...
@@ -80,6 +109,23 @@ end
end
end
task
:pylint
=>
"pylint_
#{
system
}
"
desc
"Open jasmine tests in your default browser"
task
"browse_jasmine_
#{
system
}
"
do
django_for_jasmine
(
system
)
do
|
jasmine_url
|
Launchy
.
open
(
jasmine_url
)
puts
"Press ENTER to terminate"
.
red
$stdin
.
gets
end
end
desc
"Use phantomjs to run jasmine tests from the console"
task
"phantomjs_jasmine_
#{
system
}
"
do
phantomjs
=
ENV
[
'PHANTOMJS_PATH'
]
||
'phantomjs'
django_for_jasmine
(
system
)
do
|
jasmine_url
|
sh
(
"
#{
phantomjs
}
common/test/phantom-jasmine/lib/run_jasmine_test.coffee
#{
jasmine_url
}
"
)
end
end
end
$failed_tests
=
0
...
...
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