learn-test 2.0.0.pre → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/learn-test.gemspec +1 -0
- data/lib/learn_test.rb +10 -1
- data/lib/learn_test/dependencies/karma.rb +14 -0
- data/lib/learn_test/dependencies/nodejs.rb +23 -0
- data/lib/learn_test/{strategies/jasmine/phantom_checker.rb → dependencies/phantomjs.rb} +24 -24
- data/lib/learn_test/dependencies/protractor.rb +16 -0
- data/lib/learn_test/dependency.rb +47 -0
- data/lib/learn_test/runner.rb +3 -1
- data/lib/learn_test/strategies/jasmine.rb +1 -2
- data/lib/learn_test/strategies/karma.rb +67 -0
- data/lib/learn_test/strategies/karma/karma.conf.js +19 -0
- data/lib/learn_test/strategies/protractor.rb +96 -0
- data/lib/learn_test/strategies/rspec.rb +1 -1
- data/lib/learn_test/strategy.rb +5 -0
- data/lib/learn_test/version.rb +1 -1
- data/node_modules/karma-json-reporter/.npmignore +1 -0
- data/node_modules/karma-json-reporter/LICENSE +20 -0
- data/node_modules/karma-json-reporter/README.md +91 -0
- data/node_modules/karma-json-reporter/index.js +53 -0
- data/node_modules/karma-json-reporter/package.json +79 -0
- metadata +30 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c5bde7cfc34f3b0a9f3001786b835a649065c9
|
4
|
+
data.tar.gz: 57f5fc7fa37b7ef4b6fd9344a37b970e0a332fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7223234c5351485d9cbc2c4692d707f0f58bec9730f5d0b9838b1919fd8003d722026fe08c2bd77e378042898ee9ca9b0498191e34bdd79f9deb2424368fa871
|
7
|
+
data.tar.gz: 518c57425c6573cae03eb22d54058ed67235aaba3da5f6aac68b7aab7bb040235448735829ffeeb62a81cc341384fb176eaaa5ea70dd2789a33e8bb0318a7d85
|
data/learn-test.gemspec
CHANGED
data/lib/learn_test.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'faraday'
|
3
3
|
require 'oj'
|
4
|
+
require 'colorize'
|
4
5
|
|
5
6
|
require_relative 'learn_test/version'
|
6
7
|
require_relative 'learn_test/netrc_interactor'
|
@@ -10,11 +11,19 @@ require_relative 'learn_test/username_parser'
|
|
10
11
|
require_relative 'learn_test/repo_parser'
|
11
12
|
require_relative 'learn_test/file_finder'
|
12
13
|
require_relative 'learn_test/runner'
|
13
|
-
require_relative 'learn_test/strategy'
|
14
14
|
|
15
|
+
require_relative 'learn_test/dependency'
|
16
|
+
require_relative 'learn_test/dependencies/nodejs'
|
17
|
+
require_relative 'learn_test/dependencies/phantomjs'
|
18
|
+
require_relative 'learn_test/dependencies/karma'
|
19
|
+
require_relative 'learn_test/dependencies/protractor'
|
20
|
+
|
21
|
+
require_relative 'learn_test/strategy'
|
15
22
|
require_relative 'learn_test/strategies/jasmine'
|
16
23
|
require_relative 'learn_test/strategies/python_unittest'
|
17
24
|
require_relative 'learn_test/strategies/rspec'
|
25
|
+
require_relative 'learn_test/strategies/karma'
|
26
|
+
require_relative 'learn_test/strategies/protractor'
|
18
27
|
|
19
28
|
module LearnTest
|
20
29
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module LearnTest
|
2
|
+
module Dependencies
|
3
|
+
class NodeJS < LearnTest::Dependency
|
4
|
+
def missing?
|
5
|
+
`which node`.empty?
|
6
|
+
end
|
7
|
+
|
8
|
+
def install
|
9
|
+
puts('Checking for homebrew...'.green)
|
10
|
+
die('You must have Homebrew installed') unless brew_installed?
|
11
|
+
puts('Updating brew...'.green)
|
12
|
+
print_installing('node')
|
13
|
+
run_install('brew install node')
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def brew_installed?
|
19
|
+
!`which brew`.empty?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,27 +1,25 @@
|
|
1
1
|
module LearnTest
|
2
|
-
module
|
3
|
-
class
|
4
|
-
def
|
5
|
-
|
6
|
-
|
2
|
+
module Dependencies
|
3
|
+
class PhantomJS < LearnTest::Dependency
|
4
|
+
def missing?
|
5
|
+
if mac?
|
6
|
+
die('You must have Homebrew installed') unless brew_installed?
|
7
|
+
return !phantom_installed_on_mac?
|
8
|
+
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
if !brew_installed?
|
11
|
-
puts "You must have Homebrew installed."
|
12
|
-
exit
|
13
|
-
else
|
14
|
-
if !phantom_installed_on_mac?
|
15
|
-
install_phantomjs
|
16
|
-
end
|
17
|
-
end
|
18
|
-
else
|
19
|
-
if !phantom_installed_on_linux?
|
20
|
-
puts "You must have PhantomJS installed: http://phantomjs.org/download.html"
|
21
|
-
end
|
10
|
+
if !phantom_installed_on_linux?
|
11
|
+
die("You must have PhantomJS installed: http://phantomjs.org/download.html")
|
22
12
|
end
|
13
|
+
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def install
|
18
|
+
install_phantomjs
|
23
19
|
end
|
24
20
|
|
21
|
+
private
|
22
|
+
|
25
23
|
def brew_installed?
|
26
24
|
!`which brew`.empty?
|
27
25
|
end
|
@@ -33,6 +31,12 @@ module LearnTest
|
|
33
31
|
def phantom_installed_on_linux?
|
34
32
|
phantom_installed?
|
35
33
|
end
|
34
|
+
def self.check_installation
|
35
|
+
new.check_installation
|
36
|
+
end
|
37
|
+
|
38
|
+
def check_installation
|
39
|
+
end
|
36
40
|
|
37
41
|
def phantom_installed_by_brew?
|
38
42
|
!`brew ls --versions phantomjs`.empty?
|
@@ -43,13 +47,9 @@ module LearnTest
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def install_phantomjs
|
50
|
+
print_installing('phantomjs')
|
46
51
|
`brew install phantomjs`
|
47
52
|
end
|
48
|
-
|
49
|
-
def running_on_mac?
|
50
|
-
!!RUBY_PLATFORM.match(/darwin/)
|
51
|
-
end
|
52
53
|
end
|
53
54
|
end
|
54
55
|
end
|
55
|
-
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module LearnTest
|
2
|
+
module Dependencies
|
3
|
+
class Protractor < LearnTest::Dependency
|
4
|
+
def missing?
|
5
|
+
`which protractor`.empty?
|
6
|
+
end
|
7
|
+
|
8
|
+
def install
|
9
|
+
print_installing('protractor')
|
10
|
+
run_install('npm install -g protractor')
|
11
|
+
puts 'Updating webdriver-manager...'.green
|
12
|
+
run_install('webdriver-manager update')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module LearnTest
|
2
|
+
class Dependency
|
3
|
+
attr_reader :options
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def execute
|
10
|
+
install if missing?
|
11
|
+
end
|
12
|
+
|
13
|
+
def missing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def install
|
18
|
+
end
|
19
|
+
|
20
|
+
def die(message)
|
21
|
+
end
|
22
|
+
|
23
|
+
def mac?
|
24
|
+
!!RUBY_PLATFORM.match(/darwin/)
|
25
|
+
end
|
26
|
+
|
27
|
+
def print_installing(name)
|
28
|
+
puts "Installing missing dependency #{name}...".green
|
29
|
+
end
|
30
|
+
|
31
|
+
def run_install(command)
|
32
|
+
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
|
33
|
+
while out = stdout.gets do
|
34
|
+
puts out
|
35
|
+
end
|
36
|
+
|
37
|
+
while err = stderr.gets do
|
38
|
+
puts err
|
39
|
+
end
|
40
|
+
|
41
|
+
if wait_thr.value.exitstatus != 0
|
42
|
+
die("There was an error running #{command}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/learn_test/runner.rb
CHANGED
@@ -43,6 +43,8 @@ module LearnTest
|
|
43
43
|
[
|
44
44
|
LearnTest::Strategies::Rspec,
|
45
45
|
LearnTest::Strategies::Jasmine,
|
46
|
+
LearnTest::Strategies::Karma,
|
47
|
+
LearnTest::Strategies::Protractor,
|
46
48
|
LearnTest::Strategies::PythonUnittest
|
47
49
|
]
|
48
50
|
end
|
@@ -55,7 +57,7 @@ module LearnTest
|
|
55
57
|
req.body = Oj.dump(strategy.results, mode: :compat)
|
56
58
|
end
|
57
59
|
rescue Faraday::ConnectionFailed
|
58
|
-
puts 'There was a problem connecting to Learn. Not pushing test results.'
|
60
|
+
puts 'There was a problem connecting to Learn. Not pushing test results.'.red
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
@@ -3,7 +3,6 @@ require 'erb'
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
require_relative 'jasmine/phantom_checker'
|
7
6
|
require_relative 'jasmine/initializer'
|
8
7
|
|
9
8
|
module LearnTest
|
@@ -18,7 +17,7 @@ module LearnTest
|
|
18
17
|
end
|
19
18
|
|
20
19
|
def check_dependencies
|
21
|
-
|
20
|
+
Dependencies::PhantomJS.new.execute unless options[:skip]
|
22
21
|
end
|
23
22
|
|
24
23
|
def run
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module LearnTest
|
2
|
+
module Strategies
|
3
|
+
class Karma < LearnTest::Strategy
|
4
|
+
def service_endpoint
|
5
|
+
'/e/flatiron_karma'
|
6
|
+
end
|
7
|
+
|
8
|
+
def detect
|
9
|
+
runner.files.include?('karma.conf.js')
|
10
|
+
end
|
11
|
+
|
12
|
+
def check_dependencies
|
13
|
+
Dependencies::NodeJS.new.execute
|
14
|
+
Dependencies::Karma.new.execute
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
karma_config = LearnTest::FileFinder.location_to_dir('strategies/karma/karma.conf.js')
|
19
|
+
|
20
|
+
Open3.popen3("karma start #{karma_config}") do |stdin, stdout, stderr, wait_thr|
|
21
|
+
while out = stdout.gets do
|
22
|
+
puts out
|
23
|
+
end
|
24
|
+
|
25
|
+
while err = stderr.gets do
|
26
|
+
if err.include?('Cannot find local Karma!')
|
27
|
+
@missing_karma = true
|
28
|
+
end
|
29
|
+
puts err
|
30
|
+
end
|
31
|
+
|
32
|
+
if wait_thr.value.exitstatus != 0
|
33
|
+
if @missing_karma
|
34
|
+
die("You appear to be missing karma in your local node modules. Try running `npm install`.\nIf the issue persists, check if karma is specified as a dependency in the package.json.")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def output
|
41
|
+
@output ||= File.exists?('.results.json') ? Oj.load(File.read('.results.json'), symbol_keys: true) : nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def results
|
45
|
+
@results ||= {
|
46
|
+
username: username,
|
47
|
+
github_user_id: user_id,
|
48
|
+
repo_name: runner.repo,
|
49
|
+
build: {
|
50
|
+
test_suite: [{
|
51
|
+
framework: 'karma',
|
52
|
+
formatted_output: output,
|
53
|
+
duration: 0.0
|
54
|
+
}]
|
55
|
+
},
|
56
|
+
examples: output[:summary][:success] + output[:summary][:failed],
|
57
|
+
passing_count: output[:summary][:success],
|
58
|
+
failure_count: output[:summary][:failed]
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def cleanup
|
63
|
+
FileUtils.rm('.results.json') if File.exist?('.results.json')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
var path = require('path');
|
2
|
+
|
3
|
+
var labConf = require(path.join(process.cwd(), 'karma.conf.js'));
|
4
|
+
|
5
|
+
function addJSONReporter (config) {
|
6
|
+
var _path = path.join(__dirname, '../../../../node_modules/karma-json-reporter');
|
7
|
+
config.basePath = path.join(process.cwd(), config.basePath);
|
8
|
+
config.plugins.push(require(_path));
|
9
|
+
config.reporters.push('json');
|
10
|
+
config.jsonReporter = {
|
11
|
+
stdout: false,
|
12
|
+
outputFile: path.join(process.cwd(), '.results.json')
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
module.exports = function (config) {
|
17
|
+
labConf(config);
|
18
|
+
addJSONReporter(config);
|
19
|
+
}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module LearnTest
|
4
|
+
module Strategies
|
5
|
+
class Protractor < LearnTest::Strategy
|
6
|
+
def service_endpoint
|
7
|
+
'/e/flatiron_protractor'
|
8
|
+
end
|
9
|
+
|
10
|
+
def detect
|
11
|
+
runner.files.include?('conf.js')
|
12
|
+
end
|
13
|
+
|
14
|
+
def check_dependencies
|
15
|
+
Dependencies::NodeJS.new.execute
|
16
|
+
Dependencies::Protractor.new.execute
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
Open3.popen3('protractor conf.js --resultJsonOutputFile .results.json') do |stdin, stdout, stderr, wait_thr|
|
21
|
+
while line = stdout.gets do
|
22
|
+
if line.include?('Error: Cannot find module')
|
23
|
+
@modules_missing = true
|
24
|
+
end
|
25
|
+
puts line
|
26
|
+
end
|
27
|
+
|
28
|
+
while stderr_line = stderr.gets do
|
29
|
+
if stderr_line.include?('ECONNREFUSED')
|
30
|
+
@webdriver_not_running = true
|
31
|
+
end
|
32
|
+
puts stderr_line
|
33
|
+
end
|
34
|
+
|
35
|
+
if wait_thr.value.exitstatus != 0
|
36
|
+
if @webdriver_not_running
|
37
|
+
die('Webdriver manager does not appear to be running. Run `webdriver-manager start` to start it.')
|
38
|
+
end
|
39
|
+
|
40
|
+
if @modules_missing
|
41
|
+
die("You appear to be missing npm dependencies. Try running `npm install`\nIf the issue persists, check the package.json")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def output
|
48
|
+
File.exists?('.results.json') ? Oj.load(File.read('.results.json'), symbol_keys: true) : nil
|
49
|
+
end
|
50
|
+
|
51
|
+
def results
|
52
|
+
@results ||= {
|
53
|
+
username: username,
|
54
|
+
github_user_id: user_id,
|
55
|
+
repo_name: runner.repo,
|
56
|
+
build: {
|
57
|
+
test_suite: [{
|
58
|
+
framework: 'protractor',
|
59
|
+
formatted_output: output,
|
60
|
+
duration: duration
|
61
|
+
}]
|
62
|
+
},
|
63
|
+
examples: passing_count + failure_count,
|
64
|
+
passing_count: passing_count,
|
65
|
+
failure_count: failure_count
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def cleanup
|
70
|
+
FileUtils.rm('.results.json') if File.exist?('.results.json')
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def passing_count
|
76
|
+
@passing_count ||= output.inject(0) do |count, test|
|
77
|
+
count += 1 if test[:assertions].all?{ |a| a[:passed] }
|
78
|
+
count
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def failure_count
|
83
|
+
@failure_count ||= output.inject(0) do |count, test|
|
84
|
+
count += 1 if !test[:assertions].all? { |a| a[:passed] }
|
85
|
+
count
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def duration
|
90
|
+
@duration ||= output.inject(0) do |count, test|
|
91
|
+
count += test[:duration]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/learn_test/strategy.rb
CHANGED
data/lib/learn_test/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
node_modules
|
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Douglas Duteil
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# karma-json-reporter [![NPM version](https://badge.fury.io/js/karma-json-reporter.png)](http://badge.fury.io/js/karma-json-reporter)
|
2
|
+
|
3
|
+
> JSON reporter for Karma
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
The easiest way is to keep `karma-json-reporter` as a devDependency in your `package.json`.
|
9
|
+
|
10
|
+
```json
|
11
|
+
{
|
12
|
+
"devDependencies": {
|
13
|
+
"karma": "~0.10",
|
14
|
+
"karma-json-reporter": "~1.1"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
```
|
18
|
+
|
19
|
+
You can simple do it by:
|
20
|
+
```bash
|
21
|
+
npm install karma-json-reporter --save-dev
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Use it as a reporter
|
27
|
+
|
28
|
+
```js
|
29
|
+
// karma.conf.js
|
30
|
+
module.exports = function(config) {
|
31
|
+
// ...
|
32
|
+
|
33
|
+
// json reporter directly output stringified json
|
34
|
+
reporters: ['json'],
|
35
|
+
jsonReporter: {
|
36
|
+
stdout: true,
|
37
|
+
outputFile: 'results.json' // defaults to none
|
38
|
+
}
|
39
|
+
|
40
|
+
// ...
|
41
|
+
};
|
42
|
+
```
|
43
|
+
|
44
|
+
## Output data
|
45
|
+
|
46
|
+
|
47
|
+
```js
|
48
|
+
{
|
49
|
+
"browsers": { // Collection of used browser
|
50
|
+
"<browser.id>": {
|
51
|
+
"id": "<same browser.id>",
|
52
|
+
"fullName": String,
|
53
|
+
"name": String,
|
54
|
+
"state": Number,
|
55
|
+
"lastResult": {
|
56
|
+
"success":Number,
|
57
|
+
"failed": Number,
|
58
|
+
"skipped": Number,
|
59
|
+
"total": Number,
|
60
|
+
"totalTime": Number,
|
61
|
+
"netTime":Number,
|
62
|
+
"error": Boolean,
|
63
|
+
"disconnected": Boolean
|
64
|
+
},
|
65
|
+
"launchId": Number
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"result": { // Collection result per browser
|
69
|
+
"<browser.id>": [
|
70
|
+
{
|
71
|
+
"id": Number, // spec.id
|
72
|
+
"description": String, // spec.description
|
73
|
+
"suite": Array.of(String), // spec.suite
|
74
|
+
"success": Boolean,
|
75
|
+
"skipped": Boolean,
|
76
|
+
"time": Number,
|
77
|
+
"log": Array.of(String), // spec.log
|
78
|
+
},
|
79
|
+
]
|
80
|
+
},
|
81
|
+
"summary": {
|
82
|
+
"success": Number, // total number of success
|
83
|
+
"failed": Number, // total number of fail
|
84
|
+
"error": Boolean,
|
85
|
+
"disconnected": Boolean,
|
86
|
+
"exitCode": Number
|
87
|
+
}
|
88
|
+
}
|
89
|
+
```
|
90
|
+
|
91
|
+
[Output exemple](https://gist.github.com/douglasduteil/8039664)
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/* jshint node: true */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
var path = require('path');
|
5
|
+
var fs = require('fs');
|
6
|
+
|
7
|
+
//
|
8
|
+
var JSONReporter = function (baseReporterDecorator, config, helper, logger) {
|
9
|
+
|
10
|
+
var log = logger.create('karma-json-reporter');
|
11
|
+
baseReporterDecorator(this);
|
12
|
+
|
13
|
+
var history = {
|
14
|
+
browsers : {},
|
15
|
+
result : {},
|
16
|
+
summary : {}
|
17
|
+
};
|
18
|
+
|
19
|
+
var reporterConfig = config.jsonReporter || {};
|
20
|
+
var stdout = typeof reporterConfig.stdout !== 'undefined' ? reporterConfig.stdout : true;
|
21
|
+
var outputFile = (reporterConfig.outputFile) ? helper.normalizeWinPath(path.resolve(config.basePath, reporterConfig.outputFile )) : null;
|
22
|
+
|
23
|
+
this.onSpecComplete = function(browser, result) {
|
24
|
+
history.result[browser.id] = history.result[browser.id] || [];
|
25
|
+
history.result[browser.id].push(result);
|
26
|
+
|
27
|
+
history.browsers[browser.id] = history.browsers[browser.id] || browser;
|
28
|
+
};
|
29
|
+
|
30
|
+
this.onRunComplete = function(browser, result) {
|
31
|
+
history.summary = result;
|
32
|
+
if(stdout) process.stdout.write(JSON.stringify(history));
|
33
|
+
if(outputFile) {
|
34
|
+
helper.mkdirIfNotExists(path.dirname(outputFile), function() {
|
35
|
+
fs.writeFile(outputFile, JSON.stringify(history), function(err) {
|
36
|
+
if (err) {
|
37
|
+
log.warn('Cannot write JSON\n\t' + err.message);
|
38
|
+
} else {
|
39
|
+
log.debug('JSON written to "%s".', outputFile);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
43
|
+
}
|
44
|
+
history.result = {};
|
45
|
+
};
|
46
|
+
};
|
47
|
+
|
48
|
+
JSONReporter.$inject = ['baseReporterDecorator','config','helper','logger'];
|
49
|
+
|
50
|
+
// PUBLISH DI MODULE
|
51
|
+
module.exports = {
|
52
|
+
'reporter:json': ['type', JSONReporter]
|
53
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
{
|
2
|
+
"_args": [
|
3
|
+
[
|
4
|
+
"karma-json-reporter",
|
5
|
+
"/Users/josh/code/learn-test"
|
6
|
+
]
|
7
|
+
],
|
8
|
+
"_from": "karma-json-reporter@latest",
|
9
|
+
"_id": "karma-json-reporter@1.2.0",
|
10
|
+
"_inCache": true,
|
11
|
+
"_installable": true,
|
12
|
+
"_location": "/karma-json-reporter",
|
13
|
+
"_nodeVersion": "0.12.4",
|
14
|
+
"_npmUser": {
|
15
|
+
"email": "douglasduteil@gmail.com",
|
16
|
+
"name": "douglasduteil"
|
17
|
+
},
|
18
|
+
"_npmVersion": "2.13.0",
|
19
|
+
"_phantomChildren": {},
|
20
|
+
"_requested": {
|
21
|
+
"name": "karma-json-reporter",
|
22
|
+
"raw": "karma-json-reporter",
|
23
|
+
"rawSpec": "",
|
24
|
+
"scope": null,
|
25
|
+
"spec": "latest",
|
26
|
+
"type": "tag"
|
27
|
+
},
|
28
|
+
"_requiredBy": [
|
29
|
+
"#DEV:/"
|
30
|
+
],
|
31
|
+
"_resolved": "https://registry.npmjs.org/karma-json-reporter/-/karma-json-reporter-1.2.0.tgz",
|
32
|
+
"_shasum": "e8daa3a5271cd0ba7aa4975d13d74bdb4685bf6f",
|
33
|
+
"_shrinkwrap": null,
|
34
|
+
"_spec": "karma-json-reporter",
|
35
|
+
"_where": "/Users/josh/code/learn-test",
|
36
|
+
"author": {
|
37
|
+
"name": "Douglas Duteil"
|
38
|
+
},
|
39
|
+
"bugs": {
|
40
|
+
"url": "https://github.com/douglasduteil/karma-json-reporter/issues"
|
41
|
+
},
|
42
|
+
"dependencies": {},
|
43
|
+
"description": "JSON reporter for Karma",
|
44
|
+
"devDependencies": {},
|
45
|
+
"directories": {},
|
46
|
+
"dist": {
|
47
|
+
"shasum": "e8daa3a5271cd0ba7aa4975d13d74bdb4685bf6f",
|
48
|
+
"tarball": "http://registry.npmjs.org/karma-json-reporter/-/karma-json-reporter-1.2.0.tgz"
|
49
|
+
},
|
50
|
+
"gitHead": "2850115ed36bb4844d75e8147fdcc2bfab0f89b0",
|
51
|
+
"homepage": "https://github.com/douglasduteil/karma-json-reporter",
|
52
|
+
"keywords": [
|
53
|
+
"json",
|
54
|
+
"karma-plugin",
|
55
|
+
"reporter"
|
56
|
+
],
|
57
|
+
"license": "MIT",
|
58
|
+
"main": "index.js",
|
59
|
+
"maintainers": [
|
60
|
+
{
|
61
|
+
"name": "douglasduteil",
|
62
|
+
"email": "douglasduteil@gmail.com"
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"name": "karma-json-reporter",
|
66
|
+
"optionalDependencies": {},
|
67
|
+
"peerDependencies": {
|
68
|
+
"karma": ">=0.9"
|
69
|
+
},
|
70
|
+
"readme": "ERROR: No README data found!",
|
71
|
+
"repository": {
|
72
|
+
"type": "git",
|
73
|
+
"url": "git://github.com/douglasduteil/karma-json-reporter.git"
|
74
|
+
},
|
75
|
+
"scripts": {
|
76
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
77
|
+
},
|
78
|
+
"version": "1.2.0"
|
79
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: colorize
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
description:
|
140
154
|
email:
|
141
155
|
- learn@flatironschool.com
|
@@ -153,6 +167,11 @@ files:
|
|
153
167
|
- bin/learn-test
|
154
168
|
- learn-test.gemspec
|
155
169
|
- lib/learn_test.rb
|
170
|
+
- lib/learn_test/dependencies/karma.rb
|
171
|
+
- lib/learn_test/dependencies/nodejs.rb
|
172
|
+
- lib/learn_test/dependencies/phantomjs.rb
|
173
|
+
- lib/learn_test/dependencies/protractor.rb
|
174
|
+
- lib/learn_test/dependency.rb
|
156
175
|
- lib/learn_test/file_finder.rb
|
157
176
|
- lib/learn_test/github_interactor.rb
|
158
177
|
- lib/learn_test/netrc_interactor.rb
|
@@ -172,13 +191,15 @@ files:
|
|
172
191
|
- lib/learn_test/strategies/jasmine/jasmine_favicon.png
|
173
192
|
- lib/learn_test/strategies/jasmine/jquery-1.8.0.min.js
|
174
193
|
- lib/learn_test/strategies/jasmine/jquery-ui-1.8.23.custom.min.js
|
175
|
-
- lib/learn_test/strategies/jasmine/phantom_checker.rb
|
176
194
|
- lib/learn_test/strategies/jasmine/runners/SpecRunner.html
|
177
195
|
- lib/learn_test/strategies/jasmine/runners/run-jasmine.js
|
178
196
|
- lib/learn_test/strategies/jasmine/templates/SpecRunnerTemplate.html.erb
|
179
197
|
- lib/learn_test/strategies/jasmine/templates/SpecRunnerTemplateNoColor.html.erb
|
180
198
|
- lib/learn_test/strategies/jasmine/templates/requires.yml.example
|
181
199
|
- lib/learn_test/strategies/jasmine/vendor/require.js
|
200
|
+
- lib/learn_test/strategies/karma.rb
|
201
|
+
- lib/learn_test/strategies/karma/karma.conf.js
|
202
|
+
- lib/learn_test/strategies/protractor.rb
|
182
203
|
- lib/learn_test/strategies/python_unittest.rb
|
183
204
|
- lib/learn_test/strategies/python_unittest/nose_installer.rb
|
184
205
|
- lib/learn_test/strategies/python_unittest/requirements_checker.rb
|
@@ -187,6 +208,11 @@ files:
|
|
187
208
|
- lib/learn_test/user_id_parser.rb
|
188
209
|
- lib/learn_test/username_parser.rb
|
189
210
|
- lib/learn_test/version.rb
|
211
|
+
- node_modules/karma-json-reporter/.npmignore
|
212
|
+
- node_modules/karma-json-reporter/LICENSE
|
213
|
+
- node_modules/karma-json-reporter/README.md
|
214
|
+
- node_modules/karma-json-reporter/index.js
|
215
|
+
- node_modules/karma-json-reporter/package.json
|
190
216
|
- spec/features/jasmine_jquery_fixtures_spec.rb
|
191
217
|
- spec/features/rspec_unit_spec.rb
|
192
218
|
- spec/fixtures/jasmine-jquery-fixtures/index.html
|
@@ -236,3 +262,4 @@ test_files:
|
|
236
262
|
- spec/fixtures/rspec-unit-spec/spec/spec_helper.rb
|
237
263
|
- spec/repo_parser_spec.rb
|
238
264
|
- spec/spec_helper.rb
|
265
|
+
has_rdoc:
|