5
0
Fork 0
mirror of https://github.com/hashicorp/vault-action.git synced 2025-11-07 07:06:56 +00:00

fix test imports and vitest config

This commit is contained in:
JM Faircloth 2024-03-08 17:33:36 -06:00
parent fcac78057e
commit 60c7f5af32
10 changed files with 45 additions and 12 deletions

View file

@ -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'}`

View file

@ -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'}`

View file

@ -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'}`

View file

@ -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'}`
@ -86,7 +86,7 @@ describe('authenticate with userpass', () => {
});
beforeEach(() => {
jest.resetAllMocks();
vi.resetAllMocks();
when(core.getInput)
.calledWith('method', expect.anything())

View file

@ -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/**',
],
},
})

View file

@ -1,3 +0,0 @@
module.exports = {
verbose: true
};

View file

@ -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/**',
],
},
})

View file

@ -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/**',
],
},
})

View file

@ -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/**',
],
},
})

View file

@ -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}`);