mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-07 15:16:56 +00:00
fix test imports and vitest config
This commit is contained in:
parent
fcac78057e
commit
60c7f5af32
10 changed files with 45 additions and 12 deletions
|
|
@ -7,7 +7,7 @@ import * as core from '@actions/core';
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import { when } from 'jest-when'
|
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 vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
|
||||||
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import * as core from '@actions/core';
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import { when } from 'jest-when'
|
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 vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
|
||||||
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import { when } from 'jest-when'
|
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 vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
|
||||||
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import * as core from '@actions/core';
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
import { when } from 'jest-when'
|
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 vaultUrl = `http://${process.env.VAULT_HOST || 'localhost'}:${process.env.VAULT_PORT || '8200'}`;
|
||||||
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
const vaultToken = `${process.env.VAULT_TOKEN || 'testtoken'}`
|
||||||
|
|
@ -86,7 +86,7 @@ describe('authenticate with userpass', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetAllMocks();
|
vi.resetAllMocks();
|
||||||
|
|
||||||
when(core.getInput)
|
when(core.getInput)
|
||||||
.calledWith('method', expect.anything())
|
.calledWith('method', expect.anything())
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
import { defineConfig } from 'vitest/config'
|
import { defineConfig, configDefaults } from 'vitest/config'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
// required to make jest-when work with vitest
|
// required to make jest-when work with vitest
|
||||||
globals: true,
|
globals: true,
|
||||||
|
exclude:[
|
||||||
|
...configDefaults.exclude,
|
||||||
|
'./src/**',
|
||||||
|
'**/integrationTests/e2e/**',
|
||||||
|
'**/integrationTests/e2e-tls/**',
|
||||||
|
'**/integrationTests/enterprise/**',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
verbose: true
|
|
||||||
};
|
|
||||||
15
integrationTests/e2e-tls/vitest.config.js
Normal file
15
integrationTests/e2e-tls/vitest.config.js
Normal 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/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
import { defineConfig } from 'vitest/config'
|
import { defineConfig, configDefaults } from 'vitest/config'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
// required to make jest-when work with vitest
|
// required to make jest-when work with vitest
|
||||||
globals: true,
|
globals: true,
|
||||||
|
exclude:[
|
||||||
|
...configDefaults.exclude,
|
||||||
|
'./src/**',
|
||||||
|
'**/integrationTests/basic/**',
|
||||||
|
'**/integrationTests/e2e-tls/**',
|
||||||
|
'**/integrationTests/enterprise/**',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
import { defineConfig } from 'vitest/config'
|
import { defineConfig, configDefaults } from 'vitest/config'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
// required to make jest-when work with vitest
|
// required to make jest-when work with vitest
|
||||||
globals: true,
|
globals: true,
|
||||||
|
exclude:[
|
||||||
|
...configDefaults.exclude,
|
||||||
|
'./src/**',
|
||||||
|
'**/integrationTests/basic/**',
|
||||||
|
'**/integrationTests/e2e/**',
|
||||||
|
'**/integrationTests/e2e-tls/**',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ async function getSecrets(secretRequests, client, ignoreNotFound) {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const {response} = error;
|
const {response} = error;
|
||||||
if (response?.statusCode === 404) {
|
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';
|
const ignoreNotFound = (core.getInput('ignoreNotFound', { required: false }) || 'false').toLowerCase() != 'false';
|
||||||
if (ignoreNotFound) {
|
if (ignoreNotFound) {
|
||||||
core.error(`✘ ${notFoundMsg}`);
|
core.error(`✘ ${notFoundMsg}`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue