Skip to content

Commit

Permalink
wip: replace jest with vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Mar 8, 2024
1 parent b379e88 commit fcac780
Show file tree
Hide file tree
Showing 22 changed files with 2,196 additions and 92 deletions.
3 changes: 3 additions & 0 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
8 changes: 5 additions & 3 deletions integrationTests/basic/approle_auth.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jest.mock('@actions/core');
jest.mock('@actions/core/lib/command');
import { vi, describe, test, expect } from 'vitest';

vi.mock('@actions/core');
vi.mock('@actions/core/lib/command');
import * as core from '@actions/core';

import got from 'got';
Expand Down Expand Up @@ -102,7 +104,7 @@ describe('authenticate with approle', () => {
});

beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('method', expect.anything())
Expand Down
8 changes: 5 additions & 3 deletions integrationTests/basic/integration.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jest.mock('@actions/core');
jest.mock('@actions/core/lib/command');
import { vi, describe, test, expect } from 'vitest';

vi.mock('@actions/core');
vi.mock('@actions/core/lib/command');
import * as core from '@actions/core';

import got from 'got';
Expand Down Expand Up @@ -107,7 +109,7 @@ describe('integration', () => {
});

beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('url', expect.anything())
Expand Down
3 changes: 0 additions & 3 deletions integrationTests/basic/jest.config.js

This file was deleted.

12 changes: 7 additions & 5 deletions integrationTests/basic/jwt_auth.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
jest.mock('@actions/core');
jest.mock('@actions/core/lib/command');
import { vi, describe, test, expect } from 'vitest';

vi.mock('@actions/core');
vi.mock('@actions/core/lib/command');
import * as core from '@actions/core';
import rsasign from 'jsrsasign';
import {
privateRsaKey,
privateRsaKeyBase64,
publicRsaKey
} from './rsa_keys.js');
} from './rsa_keys.js';

import got from 'got';
import { when } from 'jest-when'
Expand Down Expand Up @@ -139,7 +141,7 @@ describe('jwt auth', () => {

describe('authenticate with private key', () => {
beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('url', expect.anything())
Expand Down Expand Up @@ -189,7 +191,7 @@ describe('jwt auth', () => {
})

beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('url', expect.anything())
Expand Down
6 changes: 4 additions & 2 deletions integrationTests/basic/userpass_auth.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jest.mock('@actions/core');
jest.mock('@actions/core/lib/command');
import { vi, describe, test, expect } from 'vitest';

vi.mock('@actions/core');
vi.mock('@actions/core/lib/command');
import * as core from '@actions/core';

import got from 'got';
Expand Down
8 changes: 8 additions & 0 deletions integrationTests/basic/vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
},
})
2 changes: 2 additions & 0 deletions integrationTests/e2e-tls/e2e-tls.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, test, expect } from 'vitest';

describe('e2e-tls', () => {
it('verify', () => {
expect(process.env.SECRET).toBe("SUPERSECRET");
Expand Down
2 changes: 2 additions & 0 deletions integrationTests/e2e/e2e.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, test, expect } from 'vitest';

describe('e2e', () => {
it('verify', () => {
expect(process.env.SECRET).toBe("SUPERSECRET");
Expand Down
3 changes: 0 additions & 3 deletions integrationTests/e2e/jest.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions integrationTests/e2e/vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
},
})
10 changes: 6 additions & 4 deletions integrationTests/enterprise/enterprise.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jest.mock('@actions/core');
jest.mock('@actions/core/lib/command');
import { vi, describe, test, expect } from 'vitest';

vi.mock('@actions/core');
vi.mock('@actions/core/lib/command');
import * as core from '@actions/core';

import got from 'got';
Expand Down Expand Up @@ -41,7 +43,7 @@ describe('integration', () => {
});

beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('url', expect.anything())
Expand Down Expand Up @@ -238,7 +240,7 @@ describe('authenticate with approle', () => {
});

beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();

when(core.getInput)
.calledWith('method', expect.anything())
Expand Down
3 changes: 0 additions & 3 deletions integrationTests/enterprise/jest.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions integrationTests/enterprise/vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
},
})
9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit fcac780

Please sign in to comment.