Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lint-js-and-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/cache@v4
with:
path: vendor/bundle
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-oldest
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-lint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore, we should switch to using the newest spec/dummy gem cache.

Newest makes sense, but a separate -lint one doesn't to me.

Copy link
Contributor Author

@Judahmeek Judahmeek Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newest didn't work. That's why one of the commits is named "newest cache is still borked". It results in the gems being reinstalled just like the oldest cache key did.

The newest cache key works for other jobs, like Rspec, so I have no idea what is wrong.

All I know is that the lint key fixes the problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

- name: Install Node modules with Yarn for renderer package
run: |
yarn install --no-progress --no-emoji --frozen-lockfile
Expand All @@ -60,7 +60,7 @@ jobs:
uses: actions/cache@v4
with:
path: spec/dummy/vendor/bundle
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-oldest
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-lint
- name: Install Ruby Gems for dummy app
run: |
cd spec/dummy
Expand Down
10 changes: 10 additions & 0 deletions node_package/tests/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,13 @@
global.ReadableStream = ReadableStream;
global.ReadableStreamDefaultReader = ReadableStreamDefaultReader;
}

global.console.log("All calls to console have been disabled in jest.setup.js")

Check failure on line 66 in node_package/tests/jest.setup.js

View workflow job for this annotation

GitHub Actions / build

Replace `"All·calls·to·console·have·been·disabled·in·jest.setup.js")` with `'All·calls·to·console·have·been·disabled·in·jest.setup.js');`

global.console = {
log: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
}

Check failure on line 74 in node_package/tests/jest.setup.js

View workflow job for this annotation

GitHub Actions / build

Insert `;`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve console mocking completeness and fix formatting.

The current implementation only mocks 5 console methods, but console has many more methods (assert, clear, count, dir, group, table, time, trace, etc.). This partial mocking could lead to inconsistent behavior if other console methods are used.

-global.console = {
-  log: jest.fn(),
-  error: jest.fn(),
-  warn: jest.fn(),
-  info: jest.fn(),
-  debug: jest.fn(),
-}
+// Create a comprehensive mock of all console methods
+global.console = Object.keys(console).reduce((mockConsole, method) => {
+  mockConsole[method] = jest.fn();
+  return mockConsole;
+}, {});

Alternatively, if you want to be more selective, consider using Jest's built-in console mocking:

-global.console = {
-  log: jest.fn(),
-  error: jest.fn(),
-  warn: jest.fn(),
-  info: jest.fn(),
-  debug: jest.fn(),
-}
+// Mock console globally but allow restoration if needed
+jest.spyOn(console, 'log').mockImplementation(() => {});
+jest.spyOn(console, 'error').mockImplementation(() => {});
+jest.spyOn(console, 'warn').mockImplementation(() => {});
+jest.spyOn(console, 'info').mockImplementation(() => {});
+jest.spyOn(console, 'debug').mockImplementation(() => {});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
global.console = {
log: jest.fn(),
error: jest.fn(),
warn: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
}
// Create a comprehensive mock of all console methods
global.console = Object.keys(console).reduce((mockConsole, method) => {
mockConsole[method] = jest.fn();
return mockConsole;
}, {});
🧰 Tools
🪛 ESLint

[error] 74-74: Insert ;

(prettier/prettier)

🤖 Prompt for AI Agents
In node_package/tests/jest.setup.js around lines 68 to 74, the global console
mock only includes five methods, missing many others like assert, clear, count,
dir, group, table, time, and trace, which can cause inconsistent test behavior.
To fix this, extend the mock to include all commonly used console methods or
replace the entire global.console with Jest's built-in console mocking utility
to ensure comprehensive and consistent mocking across all console methods.

Loading