diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index 783c7e2d5..f90d45c05 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -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 - name: Install Node modules with Yarn for renderer package run: | yarn install --no-progress --no-emoji --frozen-lockfile @@ -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 diff --git a/node_package/tests/jest.setup.js b/node_package/tests/jest.setup.js index 5b4acefa3..2758e3eb8 100644 --- a/node_package/tests/jest.setup.js +++ b/node_package/tests/jest.setup.js @@ -62,3 +62,15 @@ if (typeof window !== 'undefined') { global.ReadableStream = ReadableStream; global.ReadableStreamDefaultReader = ReadableStreamDefaultReader; } + +if (!['yes', 'true', 'y', 't'].includes(process.env.ENABLE_JEST_CONSOLE || ''.toLowerCase())) { + global.console.log('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(), + }; +} diff --git a/spec/dummy/tests/react-on-rails.import.test.js b/spec/dummy/tests/react-on-rails.import.test.js index c13ef69b8..e2af3df94 100644 --- a/spec/dummy/tests/react-on-rails.import.test.js +++ b/spec/dummy/tests/react-on-rails.import.test.js @@ -1,5 +1,7 @@ import ReactOnRails from 'react-on-rails'; test('ReactOnRails', () => { - ReactOnRails.register({}); + expect(() => { + ReactOnRails.register({}); + }).not.toThrow(); }); diff --git a/spec/dummy/tests/react-on-rails.require.test.js b/spec/dummy/tests/react-on-rails.require.test.js index acac258e9..7d96d5a99 100644 --- a/spec/dummy/tests/react-on-rails.require.test.js +++ b/spec/dummy/tests/react-on-rails.require.test.js @@ -1,5 +1,7 @@ const ReactOnRails = require('react-on-rails').default; test('ReactOnRails', () => { - ReactOnRails.register({}); + expect(() => { + ReactOnRails.register({}); + }).not.toThrow(); });