Skip to content

Commit

Permalink
fix test imports and vitest config
Browse files Browse the repository at this point in the history
  • Loading branch information
fairclothjm committed Mar 11, 2024
1 parent fcac780 commit 60c7f5a
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 12 deletions.
2 changes: 1 addition & 1 deletion integrationTests/basic/approle_auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as core from '@actions/core';
import got from 'got';
import { when } from 'jest-when'

import exportSecrets from '../../src/action.js';
import { exportSecrets } from '../../src/action.js';

const vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/basic/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as core from '@actions/core';
import got from 'got';
import { when } from 'jest-when'

import exportSecrets from '../../src/action.js';
import { exportSecrets } from '../../src/action.js';

const vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
Expand Down
2 changes: 1 addition & 1 deletion integrationTests/basic/jwt_auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import got from 'got';
import { when } from 'jest-when'

import exportSecrets from '../../src/action.js';
import { exportSecrets } from '../../src/action.js';

const vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
Expand Down
4 changes: 2 additions & 2 deletions integrationTests/basic/userpass_auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as core from '@actions/core';
import got from 'got';
import { when } from 'jest-when'

import exportSecrets from '../../src/action.js';
import { exportSecrets } from '../../src/action.js';

const vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('authenticate with userpass', () => {
});

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

when(core.getInput)
.calledWith('method', expect.anything())
Expand Down
9 changes: 8 additions & 1 deletion integrationTests/basic/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { defineConfig } from 'vitest/config'
import { defineConfig, configDefaults } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
exclude:[
...configDefaults.exclude,
'./src/**',
'**/integrationTests/e2e/**',
'**/integrationTests/e2e-tls/**',
'**/integrationTests/enterprise/**',
],
},
})
3 changes: 0 additions & 3 deletions integrationTests/e2e-tls/jest.config.js

This file was deleted.

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

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
exclude:[
...configDefaults.exclude,
'./src/**',
'**/integrationTests/basic/**',
'**/integrationTests/e2e/**',
'**/integrationTests/enterprise/**',
],
},
})
9 changes: 8 additions & 1 deletion integrationTests/e2e/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { defineConfig } from 'vitest/config'
import { defineConfig, configDefaults } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
exclude:[
...configDefaults.exclude,
'./src/**',
'**/integrationTests/basic/**',
'**/integrationTests/e2e-tls/**',
'**/integrationTests/enterprise/**',
],
},
})
9 changes: 8 additions & 1 deletion integrationTests/enterprise/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { defineConfig } from 'vitest/config'
import { defineConfig, configDefaults } from 'vitest/config'

export default defineConfig({
test: {
// required to make jest-when work with vitest
globals: true,
exclude:[
...configDefaults.exclude,
'./src/**',
'**/integrationTests/basic/**',
'**/integrationTests/e2e/**',
'**/integrationTests/e2e-tls/**',
],
},
})
2 changes: 1 addition & 1 deletion src/secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function getSecrets(secretRequests, client, ignoreNotFound) {
} catch (error) {
const {response} = error;
if (response?.statusCode === 404) {
notFoundMsg = `Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}`;
let notFoundMsg = `Unable to retrieve result for "${path}" because it was not found: ${response.body.trim()}`;
const ignoreNotFound = (core.getInput('ignoreNotFound', { required: false }) || 'false').toLowerCase() != 'false';
if (ignoreNotFound) {
core.error(`✘ ${notFoundMsg}`);
Expand Down

0 comments on commit 60c7f5a

Please sign in to comment.