Skip to content

Commit 3bc31aa

Browse files
authored
Merge pull request actions#210 from dmitry-shibanov/v-dmshib/suppress-test-log-output
Suppress warning/debug/info output from tests
2 parents c21fb93 + 30cd52e commit 3bc31aa

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

__tests__/auth.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import io = require('@actions/io');
22
import fs = require('fs');
33
import path = require('path');
4+
import * as core from '@actions/core';
45
import os from 'os';
56

67
import * as auth from '../src/auth';
@@ -10,11 +11,14 @@ const settingsFile = path.join(m2Dir, auth.SETTINGS_FILE);
1011

1112
describe('auth tests', () => {
1213
let spyOSHomedir: jest.SpyInstance;
14+
let spyInfo: jest.SpyInstance;
1315

1416
beforeEach(async () => {
1517
await io.rmRF(m2Dir);
1618
spyOSHomedir = jest.spyOn(os, 'homedir');
1719
spyOSHomedir.mockReturnValue(__dirname);
20+
spyInfo = jest.spyOn(core, 'info');
21+
spyInfo.mockImplementation(() => null);
1822
}, 300000);
1923

2024
afterAll(async () => {

__tests__/cache.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ describe('dependency cache', () => {
1414
let workspace: string;
1515
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
1616
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
17+
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
18+
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
1719

1820
beforeEach(() => {
1921
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
@@ -38,7 +40,16 @@ describe('dependency cache', () => {
3840

3941
beforeEach(() => {
4042
spyInfo = jest.spyOn(core, 'info');
43+
spyInfo.mockImplementation(() => null);
44+
4145
spyWarning = jest.spyOn(core, 'warning');
46+
spyWarning.mockImplementation(() => null);
47+
48+
spyDebug = jest.spyOn(core, 'debug');
49+
spyDebug.mockImplementation(() => null);
50+
51+
spySaveState = jest.spyOn(core, 'saveState');
52+
spySaveState.mockImplementation(() => null);
4253
});
4354

4455
afterEach(() => {
@@ -58,6 +69,7 @@ describe('dependency cache', () => {
5869
spyCacheRestore = jest
5970
.spyOn(cache, 'restoreCache')
6071
.mockImplementation((paths: string[], primaryKey: string) => Promise.resolve(undefined));
72+
spyWarning.mockImplementation(() => null);
6173
});
6274

6375
it('throws error if unsupported package manager specified', () => {
@@ -117,6 +129,7 @@ describe('dependency cache', () => {
117129
spyCacheSave = jest
118130
.spyOn(cache, 'saveCache')
119131
.mockImplementation((paths: string[], key: string) => Promise.resolve(0));
132+
spyWarning.mockImplementation(() => null);
120133
});
121134

122135
it('throws error if unsupported package manager specified', () => {

__tests__/cleanup-java.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as util from '../src/util';
55

66
describe('cleanup', () => {
77
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
8+
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
89
let spyCacheSave: jest.SpyInstance<
910
ReturnType<typeof cache.saveCache>,
1011
Parameters<typeof cache.saveCache>
@@ -13,6 +14,9 @@ describe('cleanup', () => {
1314

1415
beforeEach(() => {
1516
spyWarning = jest.spyOn(core, 'warning');
17+
spyWarning.mockImplementation(() => null);
18+
spyInfo = jest.spyOn(core, 'info');
19+
spyInfo.mockImplementation(() => null);
1620
spyCacheSave = jest.spyOn(cache, 'saveCache');
1721
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
1822
spyJobStatusSuccess.mockReturnValue(true);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy