mirror of
https://github.com/actions/setup-java.git
synced 2024-11-22 16:31:00 -05:00
Merge pull request #210 from dmitry-shibanov/v-dmshib/suppress-test-log-output
Suppress warning/debug/info output from tests
This commit is contained in:
commit
3bc31aaf88
3 changed files with 21 additions and 0 deletions
|
@ -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 () => {
|
||||||
|
|
|
@ -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', () => {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import * as util from '../src/util';
|
||||||
|
|
||||||
describe('cleanup', () => {
|
describe('cleanup', () => {
|
||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
||||||
|
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
|
||||||
let spyCacheSave: jest.SpyInstance<
|
let spyCacheSave: jest.SpyInstance<
|
||||||
ReturnType<typeof cache.saveCache>,
|
ReturnType<typeof cache.saveCache>,
|
||||||
Parameters<typeof cache.saveCache>
|
Parameters<typeof cache.saveCache>
|
||||||
|
@ -13,6 +14,9 @@ describe('cleanup', () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
spyWarning = jest.spyOn(core, 'warning');
|
||||||
|
spyWarning.mockImplementation(() => null);
|
||||||
|
spyInfo = jest.spyOn(core, 'info');
|
||||||
|
spyInfo.mockImplementation(() => null);
|
||||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
||||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
||||||
spyJobStatusSuccess.mockReturnValue(true);
|
spyJobStatusSuccess.mockReturnValue(true);
|
||||||
|
|
Loading…
Reference in a new issue