jsinstrument 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jsinstrument/inserting.js +16 -16
- data/lib/jsinstrument/version.rb +1 -1
- metadata +2 -2
@@ -1,6 +1,7 @@
|
|
1
1
|
/* automatically generated by JSInstrument */
|
2
|
+
|
2
3
|
/*
|
3
|
-
* create %{js_object_name}
|
4
|
+
* create %{js_object_name} as a global object
|
4
5
|
*/
|
5
6
|
!function(root){
|
6
7
|
if (root && (typeof root.%{js_object_name} === 'undefined')) {
|
@@ -10,17 +11,15 @@
|
|
10
11
|
*/
|
11
12
|
_data: {},
|
12
13
|
/**
|
13
|
-
*
|
14
|
-
*/
|
15
|
-
_uploading: false,
|
16
|
-
/**
|
17
|
-
* mark code line
|
14
|
+
* register instrumented lines for the file
|
18
15
|
*/
|
19
|
-
|
16
|
+
register: function(file, lines) {
|
17
|
+
// replace the dot in the filename by underscore to be competible with mongodb
|
20
18
|
file = file.replace(/\./g, '_')
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
// can't register twice for one file
|
20
|
+
if(!this._data[file]) {
|
21
|
+
this._data[file] = [];
|
22
|
+
for (var i in lines) {
|
24
23
|
this._data[file][lines[i]] = 0;
|
25
24
|
}
|
26
25
|
}
|
@@ -29,6 +28,7 @@
|
|
29
28
|
* Hit a line
|
30
29
|
*/
|
31
30
|
hit: function(file, line) {
|
31
|
+
// replace the dot in the filename by underscore to be competible with mongodb
|
32
32
|
file = file.replace(/\./g, '_')
|
33
33
|
if(!this._data[file]) this._data[file] = [];
|
34
34
|
|
@@ -36,12 +36,10 @@
|
|
36
36
|
else this._data[file][line] = this._data[file][line] + 1;
|
37
37
|
},
|
38
38
|
/**
|
39
|
-
*
|
39
|
+
* Upload coverage data to server
|
40
40
|
*/
|
41
|
-
upload: function(
|
42
|
-
|
43
|
-
* Avoid dup upload
|
44
|
-
*/
|
41
|
+
upload: function(mark, force) {
|
42
|
+
// if uploading
|
45
43
|
if(!force && this._uploading) return;
|
46
44
|
|
47
45
|
var self = this;
|
@@ -120,6 +118,8 @@
|
|
120
118
|
};
|
121
119
|
}
|
122
120
|
|
123
|
-
|
121
|
+
// register the instrumented lines for current file
|
122
|
+
root.%{js_object_name}.register('%{src_filename}', %{instrumented_lines});
|
124
123
|
}(this);
|
125
124
|
|
125
|
+
|
data/lib/jsinstrument/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsinstrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rkelly
|