integration-tests-rails 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3020cc3bc2a7fdcda72ea6b7fd12bb5786b4f26b1be3ff1c8533ff6a3046de3a
|
|
4
|
+
data.tar.gz: 3603ab4f58a7b508879fda0c91901142f22c39df3894013a54e4e88e8809b396
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '032484b408cd1cfc672d6e0dfa379b1e3d01866546a750cb98d7d45d3e098941c79f77621f5431e41a2008ed1a45e0b299f38a18fe78a1a39496c2d5a00ddba7'
|
|
7
|
+
data.tar.gz: 8612c1eb1ac54ba15c2f63f236b85d07e93783f57d0fbbcdd39e2ddc6dd8521d9402bd15d53e600210f44009a7f923103a97153e6b88dbeb4a6aeee5eb745978
|
data/README.md
CHANGED
|
@@ -63,6 +63,7 @@ The `IntegrationTestsRails.setup` method accepts an optional block for further c
|
|
|
63
63
|
```ruby
|
|
64
64
|
IntegrationTestsRails.setup do |config|
|
|
65
65
|
config.chrome_url = nil # Used for remote Chrome instances. Needs remote to be true.
|
|
66
|
+
config.js_coverage = true # Whether to enable JavaScript coverage using Istanbul.
|
|
66
67
|
config.max_server_retries = 1000 # Before running the tests, Cuprite starts a server to communicate with Chrome. This sets the maximum number of retries to connect to that server.
|
|
67
68
|
config.puma_threads = '1:1' # Number of threads for the Puma server used by Cuprite.
|
|
68
69
|
config.remote = false # Whether to use a remote Chrome instance.
|
|
@@ -254,7 +255,7 @@ end
|
|
|
254
255
|
|
|
255
256
|
## JavaScript Coverage Reports
|
|
256
257
|
|
|
257
|
-
After the tests (successful, failed or cancelled), coverage reports will be generated in `coverage/javascript` by default.
|
|
258
|
+
After the tests (successful, failed or cancelled), coverage reports will be generated in `coverage/javascript` by default. This can be disabled in the configuration by setting `js_coverage` to `false`. Be sure to uninstall Istanbul packages through the rake task `rake integration_tests_rails:istanbul:uninstall` if you do not need this feature.
|
|
258
259
|
|
|
259
260
|
## Example Setups
|
|
260
261
|
|
|
@@ -37,9 +37,9 @@ module IntegrationTestsRails
|
|
|
37
37
|
</html>
|
|
38
38
|
HTML
|
|
39
39
|
|
|
40
|
-
attr_accessor :source_dir, :output_dir, :backup_dir, :coverage_path, :wait_time, :remote,
|
|
41
|
-
:
|
|
42
|
-
:
|
|
40
|
+
attr_accessor :source_dir, :output_dir, :backup_dir, :coverage_path, :wait_time, :remote, :chrome_url, :window_size,
|
|
41
|
+
:tests_page_html, :max_server_retries, :verbose, :js_coverage,
|
|
42
|
+
:timeout, :server_host, :server_port, :puma_threads, :experimental_features,
|
|
43
43
|
:retry_attempts, :retry_sleep_duration, :retry_capture_exceptions
|
|
44
44
|
|
|
45
45
|
def initialize
|
|
@@ -47,6 +47,7 @@ module IntegrationTestsRails
|
|
|
47
47
|
@chrome_url = nil
|
|
48
48
|
@coverage_path = 'coverage/nyc'
|
|
49
49
|
@experimental_features = false
|
|
50
|
+
@js_coverage = true
|
|
50
51
|
@max_server_retries = 1000
|
|
51
52
|
@output_dir = 'tmp/instrumented_js'
|
|
52
53
|
@puma_threads = '1:1'
|
|
@@ -9,14 +9,22 @@ module IntegrationTestsRails
|
|
|
9
9
|
module Istanbul
|
|
10
10
|
class << self
|
|
11
11
|
def setup
|
|
12
|
-
|
|
12
|
+
if IntegrationTestsRails.configuration.js_coverage
|
|
13
|
+
Util.configure_rspec
|
|
14
|
+
else
|
|
15
|
+
Util.log('JS coverage is disabled, skipping Istanbul setup.')
|
|
16
|
+
end
|
|
13
17
|
end
|
|
14
18
|
end
|
|
15
19
|
|
|
16
20
|
# Ensure cleanup at exit, either success, failure or cancellation.
|
|
17
21
|
at_exit do
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
if IntegrationTestsRails.configuration.js_coverage
|
|
23
|
+
Collector.generate_report
|
|
24
|
+
Collector.restore_original_files
|
|
25
|
+
else
|
|
26
|
+
Util.log('JS coverage is disabled, skipping Istanbul cleanup.')
|
|
27
|
+
end
|
|
20
28
|
rescue StandardError => e
|
|
21
29
|
warn "Istanbul cleanup failed: #{e.message}"
|
|
22
30
|
end
|
|
@@ -37,6 +37,35 @@ module IntegrationTestsRails
|
|
|
37
37
|
|
|
38
38
|
puts 'Integration tests environment setup complete.'
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
namespace :istanbul do
|
|
42
|
+
desc 'Remove Istanbul installation.'
|
|
43
|
+
task uninstall: :environment do
|
|
44
|
+
puts 'Removing Istanbul...'
|
|
45
|
+
system('yarn remove istanbul-lib-instrument istanbul-lib-coverage istanbul-lib-report istanbul-reports')
|
|
46
|
+
puts 'Istanbul removed. '
|
|
47
|
+
|
|
48
|
+
if File.exist?('.gitignore')
|
|
49
|
+
content = File.read('.gitignore')
|
|
50
|
+
new_content = content.dup
|
|
51
|
+
lines_to_remove = ['tmp/instrumented_js/', 'tmp/js_backup/']
|
|
52
|
+
lines_to_remove.each do |line|
|
|
53
|
+
if content.include?(line)
|
|
54
|
+
new_content = new_content.gsub("#{line}\n", '')
|
|
55
|
+
puts "Removed '#{line}' from .gitignore."
|
|
56
|
+
else
|
|
57
|
+
puts "'#{line}' not found in .gitignore. Skipping."
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
if new_content == content
|
|
61
|
+
puts 'No changes made to .gitignore.'
|
|
62
|
+
else
|
|
63
|
+
File.write('.gitignore', new_content)
|
|
64
|
+
puts '.gitignore updated.'
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
40
69
|
end
|
|
41
70
|
end
|
|
42
71
|
# rubocop:enable Metrics/BlockLength
|