mumuki-javascript-runner 1.6.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27f5bfb23b79be6ab30498db14509c411937ea95e009dcf2c3e08a47e262d2e9
4
- data.tar.gz: af6d8ed5c9783ce18ac3eab40230530718b9cee0b18197201ffa85bcd273212a
3
+ metadata.gz: ab49ca4f76e576d54ef38fbe359f3fe12f469de411185da6b098eb7da1de874e
4
+ data.tar.gz: 1167c0ead6b71df63a5fecebaea85f66f185922bba34350089acf51018248e2f
5
5
  SHA512:
6
- metadata.gz: cf2f50685744e546a02740be2811d7bab9e1d76c7bc0574bffa3798bed65a87fba3b22871046f8b4dffb799630f38d85db2a4444c48a02b48227e7911a9c50bc
7
- data.tar.gz: 1fe3a8346f15707cc100c6b494df926d43842f527d471b87c2cab1ef699c4796fbc05dff38af86d81caa5663da6119a026ead2c76f7bc77c512202dd8bd31ede
6
+ metadata.gz: 8db147e3d0892dcef9a1a07954482277ba8c487e8cb7e27ea2350775ee4cf05283d0c2ed74872e114a1698b840962c46cb85ebfc6c7a3dbba6209ad14c1f3f3c
7
+ data.tar.gz: 1067f1dfbe07d1f623f97f8c9fc51d0c51a8ce30b9a4ee906199fd122444d37d450988b2b4e019a9fd3fd66f8633edbf79a01cc9c5341a277ab8ad414790e9b6
@@ -4,7 +4,7 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
4
4
 
5
5
  Mumukit.runner_name = 'javascript'
6
6
  Mumukit.configure do |config|
7
- config.docker_image = 'mumuki/mumuki-mocha-worker'
7
+ config.docker_image = 'mumuki/mumuki-mocha-worker:2.0'
8
8
  config.structured = true
9
9
  config.stateful = true
10
10
  config.content_type = 'markdown'
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
@@ -1,7 +1,7 @@
1
1
  class JavascriptValidationHook < Mumukit::Hook
2
2
  def validate!(request)
3
3
  matches = request_matches?(request) do |it|
4
- it =~ /(^|\W+)(require|process|os|fs|eval|cluster|v8|vm|tty|tls|root|global|crypto|stream|events)(\W+|$)/
4
+ it =~ /(^|[^_[[:alnum:]]]+)(require|process|os|fs|eval|cluster|v8|vm|tty|tls|root|global|crypto|stream|events)([^_[[:alnum:]]]+|$)/
5
5
  end
6
6
  raise Mumukit::RequestValidationError, "You can not use #{$2} here" if matches
7
7
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JavascriptVersionHook
2
- VERSION = '1.6.1'
2
+ VERSION = '1.9.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.1
4
+ version: 1.9.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-11-11 00:00:00.000000000 Z
11
+ date: 2022-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit
@@ -16,28 +16,28 @@ 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
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []
135
- rubygems_version: 3.0.8
135
+ rubygems_version: 3.0.3
136
136
  signing_key:
137
137
  specification_version: 4
138
138
  summary: Javascript Runner for Mumuki