mumuki-javascript-runner 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/test_hook.rb +11 -4
  3. data/lib/version.rb +1 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20226f79e13d2ab4258f79b40b3fedc4c0cbc95533663170fb1c3c7fdbad9f8f
4
- data.tar.gz: 9b52ec14fe5153e27cea40130b2a143a6ba9c73c91bb87c5974908ea27404b89
3
+ metadata.gz: 5584ae96f5cefe3bebfffc73f112b1e449ce5c32e3d4ff0494223c9e0b0f18e4
4
+ data.tar.gz: 92d98ddd5222726ece6dfec3a41d41c7350163d906649595db11bb8542843c7e
5
5
  SHA512:
6
- metadata.gz: de05d16296a3b89dd7291d623d2fe6f3cead5fa8b577374a5d5e4d3e42626a0794dfb1d4da1a17db2f7878d511841e73802870c20220c7278fb05ee8197cfb43
7
- data.tar.gz: 5e37e9518248fc5ae9faef8f5337da68cacdfa8287fcb480f3ab911975aa4330ebd30079f2ab189571478e84579ff94a701316018fbe3c8a0dd38b62172ea27c
6
+ metadata.gz: 5e2d6882f17a35dd4eadac042c1f34c6785900c09b37a90e2056a8bf72247869bd9a02a95137c8edb99654e9a09df168205aeecae93013ff41682182e3476739
7
+ data.tar.gz: 5a49c40554275ed469945d858f7c27aacfc7cc83e39083580959702b12d320e5d49a2c540738a1911bea9eba38a3cb0e122bd6c7b7524425531af3424c728368
data/lib/test_hook.rb CHANGED
@@ -1,13 +1,12 @@
1
1
  class JavascriptTestHook < Mumukit::Templates::FileHook
2
2
  isolated true
3
3
  structured true, separator: '!!!JAVASCRIPT-MUMUKI-OUTPUT!!!'
4
+ line_number_offset 3, include_extra: true
4
5
 
5
6
  def compile_file_content(request)
6
7
  <<javascript
7
8
  'use strict';
8
-
9
- var assert = require('assert');
10
-
9
+ let assert = require('assert');
11
10
  #{request.extra}
12
11
  #{request.content}
13
12
  describe('', function() {
@@ -32,11 +31,19 @@ javascript
32
31
  transform(super['tests'])
33
32
  end
34
33
 
34
+ def post_process_unstructured_result(file, result, status)
35
+ if status.errored?
36
+ [content_type.code(result.gsub(/(SyntaxError: .*\n)(.|\n)*/) { $1 }), status]
37
+ else
38
+ super
39
+ end
40
+ end
41
+
35
42
  def transform(examples)
36
43
  examples.map { |e| [e['fullTitle'], e['err'].present? ? :failed : :passed, parse_out(e['err'])] }
37
44
  end
38
45
 
39
46
  def parse_out(exception)
40
- exception.present? ? exception['message'] : ''
47
+ exception.present? ? content_type.code(exception['message']) : ''
41
48
  end
42
49
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JavascriptVersionHook
2
- VERSION = '1.6.2'
2
+ VERSION = '1.7.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-javascript-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.30'
19
+ version: '2.40'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.30'
26
+ version: '2.40'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement