Compare commits

..

21 Commits

Author SHA1 Message Date
hysios hu
1b959250a0 use file to default output dir 2012-09-25 16:22:22 +08:00
hysios hu
d3a87a7fc6 remove debug log 2012-09-25 16:12:50 +08:00
hysios hu
1079c71369 add printFile function 2012-09-23 18:17:50 +08:00
hysios hu
065e69b09f fix a bug 2012-09-23 18:08:56 +08:00
hysios hu
9a47cdd6c8 add print fh 2012-09-23 17:33:27 +08:00
hysios hu
f96b931285 Runner::print 2012-09-23 17:27:03 +08:00
hysios hu
d65348a051 add a deboug print 2012-09-23 17:08:51 +08:00
hysios hu
fd383be5ac print outoutFile Name 2012-09-23 16:54:25 +08:00
hysios hu
f2126b2885 fix std:endl 2012-09-23 16:40:16 +08:00
hysios hu
453271ad33 add Print debug log 2012-09-23 11:07:43 +08:00
hysios hu
c0014ae2b7 add print 2012-09-21 18:07:19 +08:00
hysios hu
d60a95efaf add display filename in load_spec 2012-09-21 17:33:46 +08:00
hysios hu
9fa31807bf remove template modify 2012-09-20 14:59:52 +08:00
hysios hu
38ecb0e185 remove files_list JUnitReporter.js 2012-09-20 14:50:00 +08:00
hysios hu
2a429cc575 change junit file name 2012-09-20 14:26:57 +08:00
hysios hu
8ffb807aca change junit file name 2012-09-20 14:24:10 +08:00
hysios hu
c25adfcfbb change junit file name 2012-09-20 14:24:01 +08:00
hysios hu
167318eef1 add junit xml report 2012-09-20 14:13:35 +08:00
hysios hu
0a63582366 update headless 2012-09-20 14:01:41 +08:00
hysios hu
d462bd11b1 Merge branch 'master' of git://github.com/johnbintz/jasmine-headless-webkit 2012-09-20 13:32:10 +08:00
hysios
b6a64c5b1d feature: add jst template file have cache 2012-02-08 21:54:34 +08:00
9 changed files with 56 additions and 10 deletions

View File

@ -1,4 +1,4 @@
_This project is dead. You should use [Karma](http://karma-runner.github.io/) instead. I do._
_I am looking for a new maintainer for this project. Please contact me via GitHub if you're interested._
# Jasmine Headless WebKit runner

View File

@ -66,7 +66,8 @@ void Runner::loadSpec()
QVectorIterator<QString> iterator(reportFiles);
while (iterator.hasNext()) {
QFile *outputFile = new QFile(iterator.next());
QString fileName = iterator.next();
QFile *outputFile = new QFile(fileName);
outputFile->open(QIODevice::WriteOnly);
outputFiles.enqueue(outputFile);
}
@ -157,6 +158,14 @@ void Runner::print(const QString &fh, const QString &content) {
}
}
void Runner::printFile(const QString &fileName, const QString &content) {
QFile *outputFile = new QFile(fileName);
outputFile->open(QIODevice::WriteOnly);
QTextStream ts(outputFile);
ts << qPrintable(content);
ts.flush();
}
void Runner::finishSuite() {
isFinished = true;
runs = 0;

View File

@ -40,6 +40,7 @@ class Runner: public QObject {
QString getSeed();
void print(const QString &fh, const QString &content);
void printFile(const QString &fileName, const QString &content);
void finishSuite();
void ping();

View File

@ -23,10 +23,6 @@
#include "Runner.h"
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
#include <getopt.h>
#endif
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
#error Use Qt 4.7 or later version
#endif

View File

@ -24,6 +24,7 @@ module Jasmine
autoload :CoffeeTemplate, 'jasmine/headless/coffee_template'
autoload :JSTemplate, 'jasmine/headless/js_template'
autoload :JSTTemplateCache, 'jasmine/headless/jst_template_cache'
autoload :JSTTemplate, 'jasmine/headless/jst_template'
autoload :CSSTemplate, 'jasmine/headless/css_template'
autoload :NilTemplate, 'jasmine/headless/nil_template'
@ -58,4 +59,3 @@ module Jasmine
end
require 'jasmine/headless/errors'

View File

@ -8,7 +8,21 @@ module Jasmine::Headless
alert_bad_format(file)
return ''
end
%{<script type="text/javascript">#{super}</script>}
begin
data = super
cache = Jasmine::Headless::JSTTemplateCache.new(file, data)
source = cache.handle
if cache.cached?
%{<script type="text/javascript" src="#{cache.cache_file}"></script>
<script type="text/javascript">window.CSTF['#{File.split(cache.cache_file).last}'] = '#{file}';</script>}
else
%{<script type="text/javascript">#{source}</script>}
end
rescue StandardError => e
puts "[%s] Error in compiling file: %s" % [ 'jst'.color(:red), file.color(:yellow) ]
raise e
end
end
end
end

View File

@ -0,0 +1,26 @@
require 'sprockets/jst_processor'
require 'digest/sha1'
require 'fileutils'
module Jasmine
module Headless
class JSTTemplateCache < CacheableAction
def initialize(file, data)
@file = file
@data = data
end
class << self
def cache_type
"jst_template"
end
end
def action
@data
end
end
end
end

View File

@ -49,7 +49,8 @@ module Jasmine::Headless
end
def jhw_reporters
reporters.collect do |reporter, output|
reporters.collect do |reporter, report, output|
output = output || "spec/reports"
%{jasmine.getEnv().addReporter(new jasmine.HeadlessReporter.#{reporter}("#{output}"));}
end.join("\n")
end

View File

@ -68,7 +68,6 @@
checker();
});
}
jasmine.getEnv().execute();
}
</script>