logster 2.11.4 → 2.12.2

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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +63 -12
  3. data/.gitignore +2 -0
  4. data/CHANGELOG.md +15 -5
  5. data/README.md +8 -0
  6. data/assets/javascript/.gitkeep +0 -0
  7. data/assets/javascript/chunk.143.f61340b825c6a3bf6dbe.js +22 -0
  8. data/assets/javascript/chunk.178.6d9ae01775c898e7b748.js +22 -0
  9. data/assets/javascript/chunk.468.95dd450003497c781cb3.js +1213 -0
  10. data/assets/javascript/chunk.916.85a3fc9d873df80f5ea5.js +579 -0
  11. data/assets/javascript/client-app.js +1259 -280
  12. data/assets/javascript/vendor.js +4068 -3375
  13. data/assets/stylesheets/.gitkeep +0 -0
  14. data/assets/stylesheets/client-app.css +1 -1
  15. data/assets/stylesheets/vendor.css +1 -1
  16. data/build_client_app.sh +6 -8
  17. data/client-app/.editorconfig +0 -1
  18. data/client-app/.eslintignore +2 -0
  19. data/client-app/.eslintrc +10 -0
  20. data/client-app/.gitignore +1 -1
  21. data/client-app/.prettierignore +21 -0
  22. data/client-app/.prettierrc +1 -0
  23. data/client-app/.template-lintrc.js +10 -0
  24. data/client-app/README.md +4 -5
  25. data/client-app/app/app.js +2 -2
  26. data/client-app/app/components/actions-menu.js +21 -21
  27. data/client-app/app/components/back-trace.js +93 -90
  28. data/client-app/app/components/env-tab.js +41 -29
  29. data/client-app/app/components/message-info.js +78 -75
  30. data/client-app/app/components/message-row.js +20 -17
  31. data/client-app/app/components/page-nav.js +33 -24
  32. data/client-app/app/components/panel-resizer.js +53 -37
  33. data/client-app/app/components/patterns-list.js +101 -84
  34. data/client-app/app/components/tab-contents.js +15 -19
  35. data/client-app/app/components/tabbed-section.js +30 -18
  36. data/client-app/app/components/time-formatter.js +29 -18
  37. data/client-app/app/controllers/index.js +143 -119
  38. data/client-app/app/controllers/show.js +17 -13
  39. data/client-app/app/helpers/or.js +1 -1
  40. data/client-app/app/initializers/app-init.js +23 -34
  41. data/client-app/app/lib/decorators.js +4 -2
  42. data/client-app/app/lib/preload.js +7 -4
  43. data/client-app/app/lib/utilities.js +55 -54
  44. data/client-app/app/models/group.js +20 -15
  45. data/client-app/app/models/message-collection.js +153 -149
  46. data/client-app/app/models/message.js +60 -58
  47. data/client-app/app/models/pattern-item.js +24 -22
  48. data/client-app/app/router.js +2 -2
  49. data/client-app/app/routes/index.js +19 -12
  50. data/client-app/app/routes/settings.js +12 -10
  51. data/client-app/app/routes/show.js +6 -4
  52. data/client-app/app/services/events.js +4 -0
  53. data/client-app/app/styles/app.css +2 -0
  54. data/client-app/app/templates/application.hbs +1 -2
  55. data/client-app/app/templates/components/actions-menu.hbs +23 -8
  56. data/client-app/app/templates/components/back-trace.hbs +10 -3
  57. data/client-app/app/templates/components/env-tab.hbs +9 -7
  58. data/client-app/app/templates/components/message-info.hbs +65 -34
  59. data/client-app/app/templates/components/message-row.hbs +25 -8
  60. data/client-app/app/templates/components/page-nav.hbs +34 -10
  61. data/client-app/app/templates/components/panel-resizer.hbs +3 -3
  62. data/client-app/app/templates/components/patterns-list.hbs +54 -20
  63. data/client-app/app/templates/components/tabbed-section.hbs +12 -4
  64. data/client-app/app/templates/components/time-formatter.hbs +1 -1
  65. data/client-app/app/templates/index.hbs +100 -78
  66. data/client-app/app/templates/settings.hbs +30 -19
  67. data/client-app/app/templates/show.hbs +9 -8
  68. data/client-app/config/ember-cli-update.json +18 -0
  69. data/client-app/config/environment.js +13 -13
  70. data/client-app/config/icons.js +3 -3
  71. data/client-app/config/targets.js +16 -8
  72. data/client-app/ember-cli-build.js +4 -4
  73. data/client-app/package.json +41 -31
  74. data/client-app/testem.js +16 -17
  75. data/client-app/tests/index.html +8 -1
  76. data/client-app/tests/integration/components/back-trace-test.js +49 -26
  77. data/client-app/tests/integration/components/env-tab-test.js +79 -53
  78. data/client-app/tests/integration/components/message-info-test.js +25 -23
  79. data/client-app/tests/integration/components/patterns-list-test.js +14 -11
  80. data/client-app/tests/test-helper.js +8 -4
  81. data/client-app/tests/unit/controllers/index-test.js +32 -16
  82. data/client-app/tests/unit/controllers/show-test.js +5 -5
  83. data/client-app/tests/unit/routes/index-test.js +5 -5
  84. data/client-app/tests/unit/routes/show-test.js +5 -5
  85. data/client-app/yarn.lock +9673 -0
  86. data/lib/logster/version.rb +1 -1
  87. data/logster.gemspec +6 -3
  88. metadata +15 -6
  89. data/client-app/.eslintrc.js +0 -60
  90. data/client-app/.travis.yml +0 -28
  91. data/client-app/app/components/update-time.js +0 -21
  92. data/client-app/package-lock.json +0 -16639
@@ -1,84 +1,103 @@
1
1
  import { module, test } from "qunit";
2
2
  import { setupRenderingTest } from "ember-qunit";
3
- import { render, find, findAll } from "@ember/test-helpers";
3
+ import { find, findAll, render } from "@ember/test-helpers";
4
4
  import hbs from "htmlbars-inline-precompile";
5
- import { uninitialize, mutatePreload } from "client-app/lib/preload";
5
+ import { mutatePreload, uninitialize } from "client-app/lib/preload";
6
6
 
7
- module("Integration | Component | back-trace", function(hooks) {
7
+ module("Integration | Component | back-trace", function (hooks) {
8
8
  setupRenderingTest(hooks);
9
9
 
10
- hooks.beforeEach(function() {
10
+ hooks.beforeEach(function () {
11
11
  uninitialize();
12
12
  });
13
13
 
14
- hooks.afterEach(function() {
14
+ hooks.afterEach(function () {
15
15
  uninitialize();
16
16
  });
17
17
 
18
- test("backtrace lines display and work correctly", async function(assert) {
18
+ test("backtrace lines display and work correctly", async function (assert) {
19
19
  const backtrace = `/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'
20
20
  /var/www/discourse/lib/permalink_constraint.rb:6:in \`matches?'
21
21
  /var/www/discourse/plugins/discourse-prometheus/lib/middleware/metrics.rb:17:in \`call'
22
22
  activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in \`exists?'`;
23
23
  this.set("backtrace", backtrace);
24
- await render(hbs`{{back-trace backtrace=backtrace}}`);
24
+ await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
25
25
 
26
26
  const [gem, app, plugin, gem2] = findAll("a");
27
- assert.equal(
27
+ assert.strictEqual(
28
28
  gem.href,
29
29
  "https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
30
30
  );
31
31
 
32
- assert.equal(
32
+ assert.strictEqual(
33
33
  app.href,
34
34
  "https://github.com/discourse/discourse/blob/ce512452b512b909c38e9c63f2a0e1f8c17a2399/lib/permalink_constraint.rb#L6"
35
35
  );
36
36
 
37
- assert.equal(
37
+ assert.strictEqual(
38
38
  plugin.href,
39
39
  "https://github.com/discourse/discourse-prometheus/blob/master/lib/middleware/metrics.rb#L17"
40
40
  );
41
41
 
42
- assert.equal(
42
+ assert.strictEqual(
43
43
  gem2.href,
44
44
  "https://github.com/rails/rails/tree/v6.0.1/activerecord/lib/active_record/relation/finder_methods.rb#L317"
45
45
  );
46
46
 
47
47
  let gemLine = find("div.backtrace-line");
48
- assert.equal(
48
+ assert.strictEqual(
49
49
  gemLine.textContent.trim(),
50
50
  "activerecord-6.0.1/lib/active_record/relation/finder_methods.rb:317:in `exists?'",
51
51
  "gem lines are truncated"
52
52
  );
53
53
  });
54
54
 
55
- test("non-ruby backtraces don't break things", async function(assert) {
55
+ test("non-ruby backtraces don't break things", async function (assert) {
56
56
  this.set(
57
57
  "backtrace",
58
58
  `m/<@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27448
59
59
  m@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27560
60
60
  string@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27869`
61
61
  );
62
- await render(hbs`{{back-trace backtrace=backtrace}}`);
62
+ await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
63
63
  const lines = this.backtrace.split("\n");
64
64
  findAll("div.backtrace-line").forEach((node, index) => {
65
- assert.equal(node.textContent.trim(), lines[index]);
65
+ assert.strictEqual(node.textContent.trim(), lines[index]);
66
66
  });
67
67
  });
68
68
 
69
- test("Github links use commit sha", async function(assert) {
69
+ test("non-gem backtraces don't break things", async function (assert) {
70
+ this.set(
71
+ "backtrace",
72
+ `/ruby/gems/activesupport-7.0.4.1/lib/active_support/deprecation/behaviors.rb:33:in \`block in <class:Deprecation>'
73
+ /ruby/gems/activesupport-7.0.4.1/lib/active_support/deprecation/reporting.rb:26:in \`block (2 levels) in warn'
74
+ /ruby/gems/activesupport-7.0.4.1/lib/active_support/deprecation/reporting.rb:26:in \`each'
75
+ /ruby/gems/activesupport-7.0.4.1/lib/active_support/deprecation/reporting.rb:26:in \`block in warn'
76
+ <internal:kernel>:90:in \`tap'
77
+ /ruby/gems/activesupport-7.0.4.1/lib/active_support/deprecation/reporting.rb:22:in \`warn'`
78
+ );
79
+ await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
80
+ const lines = this.backtrace.split("\n");
81
+ findAll("div.backtrace-line").forEach((node, index) => {
82
+ assert.strictEqual(node.textContent.trim(), lines[index]);
83
+ });
84
+ });
85
+
86
+ test("Github links use commit sha", async function (assert) {
70
87
  const backtrace = `/var/www/discourse/lib/permalink_constraint.rb:6:in \`matches?'`;
71
88
  let env = [
72
89
  { application_version: "123abc" },
73
- { application_version: "abc123" }
90
+ { application_version: "abc123" },
74
91
  ];
75
92
  this.setProperties({
76
93
  backtrace,
77
- env
94
+ env,
78
95
  });
79
- await render(hbs`{{back-trace backtrace=backtrace env=env}}`);
96
+ await render(
97
+ hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
98
+ );
80
99
  let href = find("a").href;
81
- assert.equal(
100
+ assert.strictEqual(
82
101
  href,
83
102
  "https://github.com/discourse/discourse/blob/123abc/lib/permalink_constraint.rb#L6",
84
103
  "uses the first application_version if there are multiple versions"
@@ -86,27 +105,31 @@ string@https://discourse-cdn.com/assets/application-f59d2.br.js:1:27869`
86
105
 
87
106
  env = { application_version: "567def" };
88
107
  this.set("env", env);
89
- await render(hbs`{{back-trace backtrace=backtrace env=env}}`);
108
+ await render(
109
+ hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
110
+ );
90
111
  href = find("a").href;
91
- assert.equal(
112
+ assert.strictEqual(
92
113
  href,
93
114
  "https://github.com/discourse/discourse/blob/567def/lib/permalink_constraint.rb#L6",
94
115
  "uses application_version when env is only a hash"
95
116
  );
96
117
 
97
118
  this.set("env", null);
98
- await render(hbs`{{back-trace backtrace=backtrace env=env}}`);
119
+ await render(
120
+ hbs`<BackTrace @backtrace={{this.backtrace}} @env={{this.env}} />`
121
+ );
99
122
  href = find("a").href;
100
- assert.equal(
123
+ assert.strictEqual(
101
124
  href,
102
125
  "https://github.com/discourse/discourse/blob/ce512452b512b909c38e9c63f2a0e1f8c17a2399/lib/permalink_constraint.rb#L6",
103
126
  "falls back to preload if env doesn't contain application_version"
104
127
  );
105
128
 
106
129
  mutatePreload("application_version", null);
107
- await render(hbs`{{back-trace backtrace=backtrace}}`);
130
+ await render(hbs`<BackTrace @backtrace={{this.backtrace}} />`);
108
131
  href = find("a").href;
109
- assert.equal(
132
+ assert.strictEqual(
110
133
  href,
111
134
  "https://github.com/discourse/discourse/blob/master/lib/permalink_constraint.rb#L6",
112
135
  "falls back to master branch when neither preload nor application_version in env are available"
@@ -1,6 +1,6 @@
1
1
  import { module, test } from "qunit";
2
2
  import { setupRenderingTest } from "ember-qunit";
3
- import { render, find, findAll, click } from "@ember/test-helpers";
3
+ import { click, find, findAll, render } from "@ember/test-helpers";
4
4
  import hbs from "htmlbars-inline-precompile";
5
5
  import Message from "client-app/models/message";
6
6
  import { init } from "client-app/lib/preload";
@@ -9,11 +9,14 @@ const time1 = new Date("2010-01-01T01:00:00").getTime();
9
9
  const time2 = new Date("2015-01-01T01:00:00").getTime();
10
10
 
11
11
  const message = Message.create({
12
- env: [{ a: "aa", b: "bb", time: time1 }, { c: "cc", d: "dd", time: time2 }]
12
+ env: [
13
+ { a: "aa", b: "bb", time: time1 },
14
+ { c: "cc", d: "dd", time: time2 },
15
+ ],
13
16
  });
14
17
 
15
18
  const message2 = Message.create({
16
- env: { e: "ee", f: "ff" }
19
+ env: { e: "ee", f: "ff" },
17
20
  });
18
21
 
19
22
  const message3 = Message.create({
@@ -21,12 +24,12 @@ const message3 = Message.create({
21
24
  { env_key_2: "value1", default_expanded: "vvv1", notExpanded: "dsdcz" },
22
25
  { env_key_2: "value2", default_expanded: "vvv2", notExpanded: "uerue" },
23
26
  { env_key_2: "value3", notExpanded: "weeww" },
24
- { env_key_2: "value4", notExpanded: "cxc" }
25
- ]
27
+ { env_key_2: "value4", notExpanded: "cxc" },
28
+ ],
26
29
  });
27
30
 
28
31
  const message4 = Message.create({
29
- env: { env_key_2: "value", default_expanded: "vvv", notExpanded: "wwww" }
32
+ env: { env_key_2: "value", default_expanded: "vvv", notExpanded: "wwww" },
30
33
  });
31
34
 
32
35
  function reduceToContent(node) {
@@ -35,30 +38,38 @@ function reduceToContent(node) {
35
38
  );
36
39
  }
37
40
 
38
- module("Integration | Component | env-tab", function(hooks) {
41
+ module("Integration | Component | env-tab", function (hooks) {
39
42
  setupRenderingTest(hooks);
40
43
 
41
- test("it renders", async function(assert) {
42
- const callback = newPosition => this.set("envPosition", newPosition);
44
+ test("it renders", async function (assert) {
45
+ const callback = (newPosition) => this.set("envPosition", newPosition);
43
46
  this.setProperties({
44
47
  message,
45
48
  callback,
46
- envPosition: 0
49
+ envPosition: 0,
47
50
  });
48
51
  await render(
49
- hbs`{{env-tab message=message envChangedAction=callback currentEnvPosition=envPosition}}`
52
+ hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
50
53
  );
51
54
 
52
- assert.equal(
55
+ assert.strictEqual(
53
56
  find(".current-number").textContent,
54
57
  "1/2",
55
58
  "shows the current over the total number of env objects"
56
59
  );
57
60
  let trs = findAll("tr");
58
- assert.equal(trs.length, 3);
59
- assert.equal(reduceToContent(trs[0]), "a: aa", "has the right content");
60
- assert.equal(reduceToContent(trs[1]), "b: bb", "has the right content");
61
- assert.equal(
61
+ assert.strictEqual(trs.length, 3);
62
+ assert.strictEqual(
63
+ reduceToContent(trs[0]),
64
+ "a: aa",
65
+ "has the right content"
66
+ );
67
+ assert.strictEqual(
68
+ reduceToContent(trs[1]),
69
+ "b: bb",
70
+ "has the right content"
71
+ );
72
+ assert.strictEqual(
62
73
  reduceToContent(trs[2]),
63
74
  "time: 1 Jan 10",
64
75
  "has the right content"
@@ -76,36 +87,52 @@ module("Integration | Component | env-tab", function(hooks) {
76
87
  assert.dom("button").doesNotExist("doesn't show buttons for non-array env");
77
88
 
78
89
  trs = findAll("tr");
79
- assert.equal(trs.length, 2);
80
- assert.equal(reduceToContent(trs[0]), "e: ee", "has the right content");
81
- assert.equal(reduceToContent(trs[1]), "f: ff", "has the right content");
90
+ assert.strictEqual(trs.length, 2);
91
+ assert.strictEqual(
92
+ reduceToContent(trs[0]),
93
+ "e: ee",
94
+ "has the right content"
95
+ );
96
+ assert.strictEqual(
97
+ reduceToContent(trs[1]),
98
+ "f: ff",
99
+ "has the right content"
100
+ );
82
101
  });
83
102
 
84
- test("it works correctly", async function(assert) {
85
- const callback = newPosition => this.set("envPosition", newPosition);
103
+ test("it works correctly", async function (assert) {
104
+ const callback = (newPosition) => this.set("envPosition", newPosition);
86
105
  this.setProperties({
87
106
  message,
88
107
  callback,
89
- envPosition: 0
108
+ envPosition: 0,
90
109
  });
91
110
  await render(
92
- hbs`{{env-tab message=message envChangedAction=callback currentEnvPosition=envPosition}}`
111
+ hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
93
112
  );
94
113
 
95
114
  const buttons = findAll("button.nav-btn");
96
115
  await click(buttons[2]);
97
116
 
98
- assert.equal(
117
+ assert.strictEqual(
99
118
  find(".current-number").textContent,
100
119
  "2/2",
101
120
  "shows the current over the total number of env objects"
102
121
  );
103
122
 
104
123
  const trs = findAll("tr");
105
- assert.equal(trs.length, 3);
106
- assert.equal(reduceToContent(trs[0]), "c: cc", "has the right content");
107
- assert.equal(reduceToContent(trs[1]), "d: dd", "has the right content");
108
- assert.equal(
124
+ assert.strictEqual(trs.length, 3);
125
+ assert.strictEqual(
126
+ reduceToContent(trs[0]),
127
+ "c: cc",
128
+ "has the right content"
129
+ );
130
+ assert.strictEqual(
131
+ reduceToContent(trs[1]),
132
+ "d: dd",
133
+ "has the right content"
134
+ );
135
+ assert.strictEqual(
109
136
  reduceToContent(trs[2]),
110
137
  "time: 1 Jan 15",
111
138
  "has the right content"
@@ -119,51 +146,50 @@ module("Integration | Component | env-tab", function(hooks) {
119
146
  assert.ok(buttons[3].disabled, "forward buttons are disabled");
120
147
  });
121
148
 
122
- test("expandable env keys", async function(assert) {
123
- document.getElementById(
124
- "preloaded-data"
125
- ).dataset.preloaded = JSON.stringify({
126
- env_expandable_keys: ["env_key_2", "default_expanded"]
127
- });
149
+ test("expandable env keys", async function (assert) {
150
+ document.getElementById("preloaded-data").dataset.preloaded =
151
+ JSON.stringify({
152
+ env_expandable_keys: ["env_key_2", "default_expanded"],
153
+ });
128
154
  init();
129
- const callback = newPosition => this.set("envPosition", newPosition);
155
+ const callback = (newPosition) => this.set("envPosition", newPosition);
130
156
  this.setProperties({
131
157
  message: message3,
132
158
  callback,
133
- envPosition: 0
159
+ envPosition: 0,
134
160
  });
135
161
  await render(
136
- hbs`{{env-tab message=message envChangedAction=callback currentEnvPosition=envPosition}}`
162
+ hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
137
163
  );
138
164
 
139
165
  const trs = findAll(".env-table tr");
140
166
  const expandable = trs[0];
141
167
  const defaultExpanded = trs[1];
142
168
 
143
- assert.equal(
169
+ assert.strictEqual(
144
170
  expandable.children[1].textContent.trim(),
145
171
  "value1, 3 more",
146
172
  "expandable env keys shown correctly"
147
173
  );
148
174
 
149
- assert.equal(
175
+ assert.strictEqual(
150
176
  defaultExpanded.children[1].textContent.trim(),
151
177
  "vvv1, [vvv2]",
152
178
  "list is expanded by default when its length is 3 or less"
153
179
  );
154
180
 
155
- assert.equal(
181
+ assert.strictEqual(
156
182
  findAll("a.expand-list").length,
157
183
  1,
158
184
  "only whitelisted env keys are expandable"
159
185
  );
160
186
 
161
187
  const expandBtn = find("a.expand-list");
162
- assert.equal(expandBtn.textContent.trim(), "3 more");
188
+ assert.strictEqual(expandBtn.textContent.trim(), "3 more");
163
189
  await click(expandBtn);
164
190
 
165
191
  const expanded = find(".env-table tr");
166
- assert.equal(
192
+ assert.strictEqual(
167
193
  expanded.children[1].textContent.trim(),
168
194
  "value1, [value2, value3, value4]",
169
195
  "expanded env keys shown correctly"
@@ -172,23 +198,23 @@ module("Integration | Component | env-tab", function(hooks) {
172
198
  this.setProperties({
173
199
  message: message4,
174
200
  callback,
175
- envPosition: 0
201
+ envPosition: 0,
176
202
  });
177
203
  await render(
178
- hbs`{{env-tab message=message envChangedAction=callback currentEnvPosition=envPosition}}`
204
+ hbs`<EnvTab @message={{this.message}} @envChangedAction={{this.callback}} @currentEnvPosition={{this.envPosition}} />`
179
205
  );
180
206
  const recreatedEnv = {};
181
- findAll(".env-table tr").forEach(node => {
182
- recreatedEnv[
183
- node.children[0].innerText.trim()
184
- ] = node.children[1].innerText.trim();
207
+ findAll(".env-table tr").forEach((node) => {
208
+ recreatedEnv[node.children[0].innerText.trim()] =
209
+ node.children[1].innerText.trim();
185
210
  });
186
- Object.keys(recreatedEnv).forEach(k => {
187
- assert.equal(
188
- recreatedEnv[k],
211
+
212
+ for (const [k, v] of Object.entries(recreatedEnv)) {
213
+ assert.strictEqual(
214
+ v,
189
215
  this.message.env[k],
190
- `${k}: ${recreatedEnv[k]} === ${this.message.env[k]}`
216
+ `${k}: ${v} === ${this.message.env[k]}`
191
217
  );
192
- });
218
+ }
193
219
  });
194
220
  });
@@ -1,6 +1,6 @@
1
1
  import { module, test } from "qunit";
2
2
  import { setupRenderingTest } from "ember-qunit";
3
- import { render, find, findAll, click } from "@ember/test-helpers";
3
+ import { click, find, findAll, render } from "@ember/test-helpers";
4
4
  import hbs from "htmlbars-inline-precompile";
5
5
  import Message from "client-app/models/message";
6
6
 
@@ -10,45 +10,47 @@ const messageTitle = "This Is Title";
10
10
  const message = Message.create({
11
11
  backtrace,
12
12
  message: messageTitle,
13
- env: { c: "cc", d: "dd" }
13
+ env: { c: "cc", d: "dd" },
14
14
  });
15
15
 
16
- module("Integration | Component | message-info", function(hooks) {
16
+ module("Integration | Component | message-info", function (hooks) {
17
17
  setupRenderingTest(hooks);
18
18
 
19
- test("it renders", async function(assert) {
20
- const callback = newPosition => this.set("currentEnvPosition", newPosition);
19
+ test("it renders", async function (assert) {
20
+ const callback = (newPosition) =>
21
+ this.set("currentEnvPosition", newPosition);
21
22
  this.setProperties({
22
23
  actionsInMenu: true,
23
24
  showTitle: false,
24
25
  envPosition: 0,
25
26
  message,
26
- callback
27
+ callback,
27
28
  });
28
29
 
29
30
  await render(
30
- hbs`{{message-info
31
- currentMessage=message
32
- showTitle=showTitle
33
- currentEnvPosition=envPosition
34
- envChangedAction=callback
35
- showShare=true
36
- actionsInMenu=actionsInMenu}}`
31
+ hbs`<MessageInfo
32
+ @currentMessage={{this.message}}
33
+ @showTitle={{this.showTitle}}
34
+ @currentEnvPosition={{this.envPosition}}
35
+ @envChangedAction={{this.callback}}
36
+ @showShare={{true}}
37
+ @actionsInMenu={{this.actionsInMenu}}
38
+ />`
37
39
  );
38
40
  let activeTab = find(".message-info .content.active pre");
39
- assert.equal(
41
+ assert.strictEqual(
40
42
  activeTab.textContent.trim(),
41
43
  backtrace,
42
44
  "default active tab is backtrace"
43
45
  );
44
46
  assert.dom(".message-info .content h3").doesNotExist("no titles are shown");
45
- assert.equal(findAll(".tabs a").length, 3, "3 tabs shown");
46
- assert.equal(
47
+ assert.strictEqual(findAll(".tabs a").length, 3, "3 tabs shown");
48
+ assert.strictEqual(
47
49
  find(".tabs a.active").textContent.trim(),
48
50
  "backtrace",
49
51
  "default active tab is backtrace"
50
52
  );
51
- assert.equal(
53
+ assert.strictEqual(
52
54
  findAll(".message-actions button").length,
53
55
  2,
54
56
  "2 buttons shown when `actionsInMenu` is true"
@@ -59,7 +61,7 @@ module("Integration | Component | message-info", function(hooks) {
59
61
  assert.dom(".message-actions button.share").exists("share button is shown");
60
62
 
61
63
  await click(find(".message-actions button.expand.no-text"));
62
- assert.equal(
64
+ assert.strictEqual(
63
65
  findAll(".actions-menu button").length,
64
66
  3,
65
67
  "extra buttons shown inside a menu"
@@ -73,10 +75,10 @@ module("Integration | Component | message-info", function(hooks) {
73
75
 
74
76
  this.setProperties({
75
77
  showTitle: true,
76
- actionsInMenu: false
78
+ actionsInMenu: false,
77
79
  });
78
80
 
79
- assert.equal(
81
+ assert.strictEqual(
80
82
  findAll(".message-info .content h3").length,
81
83
  3,
82
84
  "titles are shown"
@@ -84,7 +86,7 @@ module("Integration | Component | message-info", function(hooks) {
84
86
  assert
85
87
  .dom(".message-actions button.expand.no-text")
86
88
  .doesNotExist("menu expand button is not shown");
87
- assert.equal(
89
+ assert.strictEqual(
88
90
  findAll(".message-actions button").length,
89
91
  4,
90
92
  "all actions buttons are shown inline when `actionsInMenu` is false"
@@ -92,7 +94,7 @@ module("Integration | Component | message-info", function(hooks) {
92
94
 
93
95
  await click(findAll(".tabs a")[0]);
94
96
  activeTab = find(".message-info .content.active pre");
95
- assert.equal(activeTab.textContent, messageTitle, "can switch tabs");
97
+ assert.strictEqual(activeTab.textContent, messageTitle, "can switch tabs");
96
98
 
97
99
  assert
98
100
  .dom(".message-actions button.solve")
@@ -108,7 +110,7 @@ module("Integration | Component | message-info", function(hooks) {
108
110
 
109
111
  message.set("env", [
110
112
  { sd: "dx", application_version: "fsfdsf" },
111
- { vcv: "dxc" }
113
+ { vcv: "dxc" },
112
114
  ]);
113
115
  this.set("message", message);
114
116
  assert
@@ -1,20 +1,21 @@
1
1
  import { module, test } from "qunit";
2
2
  import { setupRenderingTest } from "ember-qunit";
3
3
  import hbs from "htmlbars-inline-precompile";
4
- import { fillIn, render, findAll } from "@ember/test-helpers";
4
+ import { fillIn, findAll, render } from "@ember/test-helpers";
5
5
  import Pattern from "client-app/models/pattern-item";
6
6
 
7
- module("Integration | Component | patterns-list", function(hooks) {
7
+ module("Integration | Component | patterns-list", function (hooks) {
8
8
  setupRenderingTest(hooks);
9
9
 
10
- test("it renders", async function(assert) {
10
+ test("it renders", async function (assert) {
11
11
  this.setProperties({
12
12
  mutable: true,
13
- patterns: []
13
+ patterns: [],
14
14
  });
15
15
  await render(
16
- hbs`{{patterns-list patterns=patterns mutable=mutable key="suppression"}}`
16
+ hbs`<PatternsList @patterns={{this.patterns}} @mutable={{this.mutable}} @key="suppression" />`
17
17
  );
18
+
18
19
  assert
19
20
  .dom(".pattern-input")
20
21
  .exists("It shows an input when patterns are emtpy");
@@ -25,7 +26,7 @@ module("Integration | Component | patterns-list", function(hooks) {
25
26
  const pattern1 = Pattern.create({ value: "/somepattern/" });
26
27
  const pattern2 = Pattern.create({ value: "/anotherpattern/" });
27
28
  this.set("patterns", [pattern1, pattern2]);
28
- assert.equal(
29
+ assert.strictEqual(
29
30
  findAll(".pattern-input").length,
30
31
  3, // yes 3 because there is always an empty pattern input
31
32
  "It correctly displays patterns"
@@ -34,15 +35,17 @@ module("Integration | Component | patterns-list", function(hooks) {
34
35
  .dom(".btn.save")
35
36
  .doesNotExist("No save buttons are shown when there is 0 buffer");
36
37
  const counters = findAll("input.count");
37
- assert.equal(counters.length, 3, "counters shown for all patterns");
38
+ assert.strictEqual(counters.length, 3, "counters shown for all patterns");
38
39
  assert.ok(
39
- counters.every(c => c.disabled),
40
+ counters.every((c) => c.disabled),
40
41
  "counters are disabled"
41
42
  );
42
43
 
43
44
  pattern1.set("count", 6);
44
45
  this.set("patterns", [pattern1, pattern2]);
45
- const counterPresent = !!findAll("input.count").find(c => c.value === "6");
46
+ const counterPresent = !!findAll("input.count").find(
47
+ (c) => c.value === "6"
48
+ );
46
49
  assert.ok(counterPresent, "counter shows correct value");
47
50
  assert.dom(".btn.reset").exists("Reset button is shown");
48
51
 
@@ -55,7 +58,7 @@ module("Integration | Component | patterns-list", function(hooks) {
55
58
  .exists("Save buttons are shown when there is buffer");
56
59
  assert.dom(".btn.trash").exists("Trash buttons are shown");
57
60
 
58
- let disabled = inputs.every(inp => inp.disabled);
61
+ let disabled = inputs.every((inp) => inp.disabled);
59
62
  assert.notOk(
60
63
  disabled,
61
64
  "All inputs are not disabled when the list is mutable"
@@ -64,7 +67,7 @@ module("Integration | Component | patterns-list", function(hooks) {
64
67
  this.set("mutable", false);
65
68
 
66
69
  inputs = findAll(".pattern-input");
67
- disabled = inputs.every(inp => inp.disabled);
70
+ disabled = inputs.every((inp) => inp.disabled);
68
71
  assert.ok(disabled, "All inputs are disabled when the list is immutable");
69
72
  assert
70
73
  .dom(".btn.trash")
@@ -1,8 +1,12 @@
1
- import Application from '../app';
2
- import config from '../config/environment';
3
- import { setApplication } from '@ember/test-helpers';
4
- import { start } from 'ember-qunit';
1
+ import Application from "client-app/app";
2
+ import config from "client-app/config/environment";
3
+ import * as QUnit from "qunit";
4
+ import { setApplication } from "@ember/test-helpers";
5
+ import { setup } from "qunit-dom";
6
+ import { start } from "ember-qunit";
5
7
 
6
8
  setApplication(Application.create(config.APP));
7
9
 
10
+ setup(QUnit.assert);
11
+
8
12
  start();