From 2e40ee8132bd3d4f60cc982ebb4e8a27669788f9 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 23 Aug 2021 11:31:06 +0300 Subject: [PATCH 1/2] suppress tests log output --- __tests__/auth.test.ts | 4 ++++ __tests__/cache.test.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/__tests__/auth.test.ts b/__tests__/auth.test.ts index fccb3fe5..94ad7e1c 100644 --- a/__tests__/auth.test.ts +++ b/__tests__/auth.test.ts @@ -1,6 +1,7 @@ import io = require('@actions/io'); import fs = require('fs'); import path = require('path'); +import * as core from '@actions/core'; import os from 'os'; import * as auth from '../src/auth'; @@ -10,11 +11,14 @@ const settingsFile = path.join(m2Dir, auth.SETTINGS_FILE); describe('auth tests', () => { let spyOSHomedir: jest.SpyInstance; + let spyInfo: jest.SpyInstance; beforeEach(async () => { await io.rmRF(m2Dir); spyOSHomedir = jest.spyOn(os, 'homedir'); spyOSHomedir.mockReturnValue(__dirname); + spyInfo = jest.spyOn(core, 'info'); + spyInfo.mockImplementation(() => null); }, 300000); afterAll(async () => { diff --git a/__tests__/cache.test.ts b/__tests__/cache.test.ts index 54856ee6..b748e802 100644 --- a/__tests__/cache.test.ts +++ b/__tests__/cache.test.ts @@ -14,6 +14,8 @@ describe('dependency cache', () => { let workspace: string; let spyInfo: jest.SpyInstance>; let spyWarning: jest.SpyInstance>; + let spyDebug: jest.SpyInstance>; + let spySaveState: jest.SpyInstance>; beforeEach(() => { workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-')); @@ -38,7 +40,16 @@ describe('dependency cache', () => { beforeEach(() => { spyInfo = jest.spyOn(core, 'info'); + spyInfo.mockImplementation(() => null); + spyWarning = jest.spyOn(core, 'warning'); + spyWarning.mockImplementation(() => null); + + spyDebug = jest.spyOn(core, 'debug'); + spyDebug.mockImplementation(() => null); + + spySaveState = jest.spyOn(core, 'saveState'); + spySaveState.mockImplementation(() => null); }); afterEach(() => { @@ -58,6 +69,7 @@ describe('dependency cache', () => { spyCacheRestore = jest .spyOn(cache, 'restoreCache') .mockImplementation((paths: string[], primaryKey: string) => Promise.resolve(undefined)); + spyWarning.mockImplementation(() => null); }); it('throws error if unsupported package manager specified', () => { @@ -117,6 +129,7 @@ describe('dependency cache', () => { spyCacheSave = jest .spyOn(cache, 'saveCache') .mockImplementation((paths: string[], key: string) => Promise.resolve(0)); + spyWarning.mockImplementation(() => null); }); it('throws error if unsupported package manager specified', () => { From 30cd52e29bb0a368d0d5ded2052280264ae4231f Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 23 Aug 2021 11:54:48 +0300 Subject: [PATCH 2/2] fix warning output in cleanup-java --- __tests__/cleanup-java.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/__tests__/cleanup-java.test.ts b/__tests__/cleanup-java.test.ts index b3f2b52c..19551553 100644 --- a/__tests__/cleanup-java.test.ts +++ b/__tests__/cleanup-java.test.ts @@ -5,6 +5,7 @@ import * as util from '../src/util'; describe('cleanup', () => { let spyWarning: jest.SpyInstance>; + let spyInfo: jest.SpyInstance>; let spyCacheSave: jest.SpyInstance< ReturnType, Parameters @@ -13,6 +14,9 @@ describe('cleanup', () => { beforeEach(() => { spyWarning = jest.spyOn(core, 'warning'); + spyWarning.mockImplementation(() => null); + spyInfo = jest.spyOn(core, 'info'); + spyInfo.mockImplementation(() => null); spyCacheSave = jest.spyOn(cache, 'saveCache'); spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess'); spyJobStatusSuccess.mockReturnValue(true);