jest: mocks already cleared through configuration
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -14,17 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
import {describe, expect, it, jest, test} from '@jest/globals';
|
||||||
|
|
||||||
import {BuildKit} from '../../src/buildkit/buildkit';
|
import {BuildKit} from '../../src/buildkit/buildkit';
|
||||||
import {Builder} from '../../src/buildx/builder';
|
import {Builder} from '../../src/buildx/builder';
|
||||||
|
|
||||||
import {BuilderInfo} from '../../src/types/buildx/builder';
|
import {BuilderInfo} from '../../src/types/buildx/builder';
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
||||||
return {
|
return {
|
||||||
name: 'builder2',
|
name: 'builder2',
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, jest, test, beforeEach, afterEach} from '@jest/globals';
|
import {describe, expect, jest, test, afterEach} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
@@ -38,10 +38,6 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {afterEach, beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
import {afterEach, describe, expect, it, jest, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
@@ -49,10 +49,6 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -39,10 +39,6 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
import {describe, expect, it, jest, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@@ -25,10 +25,6 @@ import {BuilderInfo} from '../../src/types/buildx/builder';
|
|||||||
|
|
||||||
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
||||||
return {
|
return {
|
||||||
name: 'builder2',
|
name: 'builder2',
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, jest, test, beforeEach, afterEach} from '@jest/globals';
|
import {describe, expect, it, jest, test, afterEach} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
@@ -25,10 +25,6 @@ import {Install} from '../../src/buildx/install';
|
|||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest');
|
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest');
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
import {describe, expect, jest, it, beforeEach, afterEach} from '@jest/globals';
|
import {describe, expect, jest, it, afterEach} from '@jest/globals';
|
||||||
|
|
||||||
import {Context} from '../src/context';
|
import {Context} from '../src/context';
|
||||||
|
|
||||||
@@ -36,10 +36,6 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,10 +31,6 @@ const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
|||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
|
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ import {Install} from '../../src/docker/install';
|
|||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-install-jest');
|
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-install-jest');
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,17 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, jest, it, beforeEach} from '@jest/globals';
|
import {describe, expect, jest, it} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import {DockerHub} from '../src/dockerhub';
|
import {DockerHub} from '../src/dockerhub';
|
||||||
import {RepositoryResponse, RepositoryTagsResponse} from '../src/types/dockerhub';
|
import {RepositoryResponse, RepositoryTagsResponse} from '../src/types/dockerhub';
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
import repoInfoFixture from './fixtures/dockerhub-repoinfo.json';
|
import repoInfoFixture from './fixtures/dockerhub-repoinfo.json';
|
||||||
import repoTagsFixture from './fixtures/dockerhub-repotags.json';
|
import repoTagsFixture from './fixtures/dockerhub-repotags.json';
|
||||||
import repoAllTagsFixture from './fixtures/dockerhub-repoalltags.json';
|
import repoAllTagsFixture from './fixtures/dockerhub-repoalltags.json';
|
||||||
|
|||||||
@@ -14,14 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {beforeEach, describe, expect, it, jest} from '@jest/globals';
|
import {describe, expect, it, jest} from '@jest/globals';
|
||||||
|
|
||||||
import {Exec} from '../src/exec';
|
import {Exec} from '../src/exec';
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('exec', () => {
|
describe('exec', () => {
|
||||||
it('returns docker version', async () => {
|
it('returns docker version', async () => {
|
||||||
const execSpy = jest.spyOn(Exec, 'exec');
|
const execSpy = jest.spyOn(Exec, 'exec');
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import {Exec} from '../src/exec';
|
|||||||
import {ExecOutput} from '@actions/exec';
|
import {ExecOutput} from '@actions/exec';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks();
|
|
||||||
jest.restoreAllMocks();
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ import * as core from '@actions/core';
|
|||||||
import {GitHub} from '../src/github';
|
import {GitHub} from '../src/github';
|
||||||
import {GitHubRepo} from '../src/types/github';
|
import {GitHubRepo} from '../src/types/github';
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
import repoFixture from './fixtures/github-repo.json';
|
import repoFixture from './fixtures/github-repo.json';
|
||||||
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
||||||
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {afterEach, beforeEach, describe, expect, jest, test} from '@jest/globals';
|
import {afterEach, describe, expect, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as rimraf from 'rimraf';
|
import * as rimraf from 'rimraf';
|
||||||
@@ -26,10 +26,6 @@ const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
|||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
|
const tmpDir = path.join(process.env.TEMP || '/tmp', 'docker-jest');
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
rimraf.sync(tmpDir);
|
rimraf.sync(tmpDir);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,16 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
|
import {describe, expect, it, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import {Util} from '../src/util';
|
import {Util} from '../src/util';
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getInputList', () => {
|
describe('getInputList', () => {
|
||||||
it('single line correctly', async () => {
|
it('single line correctly', async () => {
|
||||||
await setInput('foo', 'bar');
|
await setInput('foo', 'bar');
|
||||||
|
|||||||
Reference in New Issue
Block a user