diff_test 0.7.0 → 0.8.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: 0c9bb00a4ed3e786eeea894db16fc53b880e1cb86a9bc297df003e9697772151
4
- data.tar.gz: 4060332f4db48744bbe0ac76a6d812c26854dc232331508da5f0f98ce849c0a9
3
+ metadata.gz: 194963612fbe79dd0506ee1d92e500fca33e8aacf6b5fe38b00cb91741a64367
4
+ data.tar.gz: 7a8f7a9a4e516cff513ae27247397ac40d35ed697ca5a483aed94a75d60bc668
5
5
  SHA512:
6
- metadata.gz: af7bce53595bdfbfb97c62959bdcb388638b5991d197852ab269e1e9afd61854d28dae7f0771307f497cdf4e1c45a7b8f04bb0a7200ced9f2c91e9bda78f2fcb
7
- data.tar.gz: 92fcc77616d2a327934f228560b8adfec15f6ff4421c63460d097763f4ad731d2f55617082ed61bf683cb13cb856ef7edcb09127e4cc4aa34ec7f53656dcc114
6
+ metadata.gz: 55bf9771f23900a6f3c0800e090db8dc7884acf9e0432573e25a4e4f75cb5adb20af9f750bb0c04e8a765f91503c4fa10ec559dbb34b77d2802e1a2ffea9c560
7
+ data.tar.gz: 6ee7fb4f979941883644d0bf27c29832b613c4e90c66f962beaffe0282b1c9d80761e73009d7da0f823f017c44d8d665ec0a9015222986da1bae53e7c019b03e
data/README.md CHANGED
@@ -214,6 +214,7 @@ x Wrap run_one_method ?
214
214
  - skip setup hooks
215
215
  - tracks stuff in before_setup as well
216
216
  - path/skip setup_fixtures
217
+ x batch send beacon
217
218
 
218
219
 
219
220
 
@@ -245,3 +246,6 @@ test/services/zoom_webhook_event_processor_test.rb
245
246
  11.50 - Diff Test (only constant)
246
247
  10.50 - Diff Test (only tracepoint)
247
248
  12.68 - Diff Test (constant + file_in_project + add to set)
249
+
250
+ /Users/owaiskhan/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/diff_test-0.8.0/lib/diff_test/test_suite_execution.rb:43: warning: mismatched indentations at 'end' with 'def' at 41
251
+ /Users/owaiskhan/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/diff_test-0.8.0/lib/diff_test/test_suite_execution.rb:69: warning: assigned but unused variable - response
@@ -123,7 +123,7 @@ module DiffTest
123
123
 
124
124
  def integratable?
125
125
  return false if ENV['DIFF_TEST_DISABLED'] == '1'
126
- return false if defined?(::Rails) && !Rails.env.test?
126
+ return false if defined?(::Rails) && ::Rails.respond_to?(:env) && !::Rails.env.test?
127
127
  return false if DiffTest::Helper.on_skipped_branch?
128
128
  return false if DiffTest::Helper.on_skipped_commit?
129
129
 
@@ -97,7 +97,7 @@ module DiffTest
97
97
  new_lines = lines.dup
98
98
  new_lines.insert(insert_index, text_to_insert)
99
99
 
100
- new_lines.join("\n") + "\n"
100
+ new_lines.join("\n")
101
101
  end
102
102
  end
103
103
  end
@@ -36,13 +36,26 @@ module DiffTest
36
36
  def script
37
37
  <<~HTML
38
38
  <script>
39
+ let timeout = null
39
40
  var owner = globalThis || window
40
41
  owner.diffTestTrackedJsFiles = owner.diffTestTrackedJsFiles || [];
41
42
  owner.diffTestTrackJsFile = function(file_path) {
43
+ owner.diffTestTrackedJsFiles.push(file_path);
44
+ if(!timeout) {
45
+ timeout = setTimeout(flushTrackedJsFiles, 0);
46
+ }
47
+ }
48
+
49
+ owner.diffTestTrackJsFileAuto = owner.diffTestTrackJsFile;
50
+
51
+ function flushTrackedJsFiles() {
52
+ timeout = null
53
+ const file_paths = owner.diffTestTrackedJsFiles;
54
+ owner.diffTestTrackedJsFiles = [];
55
+
42
56
  const path = "/__diff_test_js_beacon";
43
- const payload = JSON.stringify({ test_id: #{DiffTest::TestExecution.current.id.to_json}, file_path: file_path });
57
+ const payload = JSON.stringify({ test_id: #{DiffTest::TestExecution.current.id.to_json}, file_paths: file_paths });
44
58
 
45
- owner.diffTestTrackedJsFiles.push(file_path);
46
59
  if (owner.navigator && owner.navigator.sendBeacon) {
47
60
  // Use sendBeacon in capable browsers/environments
48
61
  window.navigator.sendBeacon(path, payload);
@@ -58,8 +71,6 @@ module DiffTest
58
71
  });
59
72
  }
60
73
  }
61
-
62
- owner.diffTestTrackJsFileAuto = owner.diffTestTrackJsFile;
63
74
  </script>
64
75
  HTML
65
76
  end
@@ -19,7 +19,9 @@ module DiffTest
19
19
  if path.include?('__diff_test_js_beacon')
20
20
  body = env['rack.input'].read
21
21
  json = JSON.parse(body)
22
- DiffTest::Trackers::JsFile.record_by_test_id(json['test_id'], json['file_path'])
22
+ json['file_paths'].each do |file_path|
23
+ DiffTest::Trackers::JsFile.record_by_test_id(json['test_id'], file_path)
24
+ end
23
25
  [204, {}, []]
24
26
  else
25
27
  env.delete('HTTP_IF_NONE_MATCH')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DiffTest
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diff_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owais