1
0
Fork 0
mirror of https://github.com/actions/setup-java synced 2024-11-09 15:12:39 +00:00

suppress tests log output

This commit is contained in:
Dmitry Shibanov 2021-08-23 11:31:06 +03:00
parent c21fb9392d
commit 2e40ee8132
2 changed files with 17 additions and 0 deletions

View file

@ -1,6 +1,7 @@
import io = require('@actions/io'); import io = require('@actions/io');
import fs = require('fs'); import fs = require('fs');
import path = require('path'); import path = require('path');
import * as core from '@actions/core';
import os from 'os'; import os from 'os';
import * as auth from '../src/auth'; import * as auth from '../src/auth';
@ -10,11 +11,14 @@ const settingsFile = path.join(m2Dir, auth.SETTINGS_FILE);
describe('auth tests', () => { describe('auth tests', () => {
let spyOSHomedir: jest.SpyInstance; let spyOSHomedir: jest.SpyInstance;
let spyInfo: jest.SpyInstance;
beforeEach(async () => { beforeEach(async () => {
await io.rmRF(m2Dir); await io.rmRF(m2Dir);
spyOSHomedir = jest.spyOn(os, 'homedir'); spyOSHomedir = jest.spyOn(os, 'homedir');
spyOSHomedir.mockReturnValue(__dirname); spyOSHomedir.mockReturnValue(__dirname);
spyInfo = jest.spyOn(core, 'info');
spyInfo.mockImplementation(() => null);
}, 300000); }, 300000);
afterAll(async () => { afterAll(async () => {

View file

@ -14,6 +14,8 @@ describe('dependency cache', () => {
let workspace: string; let workspace: string;
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>; let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>; let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
beforeEach(() => { beforeEach(() => {
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-')); workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
@ -38,7 +40,16 @@ describe('dependency cache', () => {
beforeEach(() => { beforeEach(() => {
spyInfo = jest.spyOn(core, 'info'); spyInfo = jest.spyOn(core, 'info');
spyInfo.mockImplementation(() => null);
spyWarning = jest.spyOn(core, 'warning'); 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(() => { afterEach(() => {
@ -58,6 +69,7 @@ describe('dependency cache', () => {
spyCacheRestore = jest spyCacheRestore = jest
.spyOn(cache, 'restoreCache') .spyOn(cache, 'restoreCache')
.mockImplementation((paths: string[], primaryKey: string) => Promise.resolve(undefined)); .mockImplementation((paths: string[], primaryKey: string) => Promise.resolve(undefined));
spyWarning.mockImplementation(() => null);
}); });
it('throws error if unsupported package manager specified', () => { it('throws error if unsupported package manager specified', () => {
@ -117,6 +129,7 @@ describe('dependency cache', () => {
spyCacheSave = jest spyCacheSave = jest
.spyOn(cache, 'saveCache') .spyOn(cache, 'saveCache')
.mockImplementation((paths: string[], key: string) => Promise.resolve(0)); .mockImplementation((paths: string[], key: string) => Promise.resolve(0));
spyWarning.mockImplementation(() => null);
}); });
it('throws error if unsupported package manager specified', () => { it('throws error if unsupported package manager specified', () => {