Skip to content

Commit b101358

Browse files
authored
Have the lint job its own cache keys (#1749)
* have the lint job use its own cache key * disable all console logs during Jest tests
1 parent 673c85a commit b101358

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.github/workflows/lint-js-and-ruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/cache@v4
4040
with:
4141
path: vendor/bundle
42-
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-oldest
42+
key: package-app-gem-cache-${{ hashFiles('Gemfile.lock') }}-lint
4343
- name: Install Node modules with Yarn for renderer package
4444
run: |
4545
yarn install --no-progress --no-emoji --frozen-lockfile
@@ -60,7 +60,7 @@ jobs:
6060
uses: actions/cache@v4
6161
with:
6262
path: spec/dummy/vendor/bundle
63-
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-oldest
63+
key: dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}-lint
6464
- name: Install Ruby Gems for dummy app
6565
run: |
6666
cd spec/dummy

node_package/tests/jest.setup.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,15 @@ if (typeof window !== 'undefined') {
6262
global.ReadableStream = ReadableStream;
6363
global.ReadableStreamDefaultReader = ReadableStreamDefaultReader;
6464
}
65+
66+
if (!['yes', 'true', 'y', 't'].includes(process.env.ENABLE_JEST_CONSOLE || ''.toLowerCase())) {
67+
global.console.log('All calls to console have been disabled in jest.setup.js');
68+
69+
global.console = {
70+
log: jest.fn(),
71+
error: jest.fn(),
72+
warn: jest.fn(),
73+
info: jest.fn(),
74+
debug: jest.fn(),
75+
};
76+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import ReactOnRails from 'react-on-rails';
22

33
test('ReactOnRails', () => {
4-
ReactOnRails.register({});
4+
expect(() => {
5+
ReactOnRails.register({});
6+
}).not.toThrow();
57
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const ReactOnRails = require('react-on-rails').default;
22

33
test('ReactOnRails', () => {
4-
ReactOnRails.register({});
4+
expect(() => {
5+
ReactOnRails.register({});
6+
}).not.toThrow();
57
});

0 commit comments

Comments
 (0)