ci: reveal sdk/js-query test errors

This commit is contained in:
Evan Gray 2024-07-31 16:06:11 -04:00 committed by Evan Gray
parent 3e13e79c66
commit eebc7ae883
2 changed files with 35 additions and 16 deletions

View File

@ -1,5 +1,5 @@
import { beforeAll, describe, expect, jest, test } from "@jest/globals";
import axios, { AxiosResponse } from "axios";
import axios, { AxiosError, AxiosResponse } from "axios";
import Web3, { ETH_DATA_FORMAT } from "web3";
import {
ChainQueryType,
@ -18,6 +18,20 @@ import {
jest.setTimeout(125000);
// Save Jest from circular axios errors
axios.interceptors.response.use(
(r) => r,
(err: AxiosError) => {
const error = new Error(
`${err.message}${err?.response?.data ? `: ${err.response.data}` : ""}`
) as any;
error.response = err.response
? { data: err.response.data, status: err.response.status }
: undefined;
throw error;
}
);
const CI = process.env.CI;
const ENV = "DEVNET";
const ETH_NODE_URL = CI ? "http://eth-devnet:8545" : "http://localhost:8545";

View File

@ -1,31 +1,36 @@
import {
afterAll,
beforeAll,
describe,
expect,
jest,
test,
} from "@jest/globals";
import Web3, { ETH_DATA_FORMAT } from "web3";
import axios from "axios";
import { AxiosResponse } from "axios";
import { describe, expect, jest, test } from "@jest/globals";
import axios, { AxiosError, AxiosResponse } from "axios";
import base58 from "bs58";
import {
ChainQueryType,
PerChainQueryRequest,
QueryRequest,
QueryResponse,
sign,
SolanaAccountQueryRequest,
SolanaAccountQueryResponse,
SolanaAccountResult,
SolanaPdaEntry,
SolanaPdaQueryRequest,
SolanaPdaQueryResponse,
PerChainQueryRequest,
QueryRequest,
sign,
QueryResponse,
} from "..";
jest.setTimeout(125000);
// Save Jest from circular axios errors
axios.interceptors.response.use(
(r) => r,
(err: AxiosError) => {
const error = new Error(
`${err.message}${err?.response?.data ? `: ${err.response.data}` : ""}`
) as any;
error.response = err.response
? { data: err.response.data, status: err.response.status }
: undefined;
throw error;
}
);
const CI = process.env.CI;
const ENV = "DEVNET";
const SERVER_URL = CI ? "http://query-server:" : "http://localhost:";