I'm currently utilizing jest for mocking my axios
requests. Here is an example of my test implementation:
// External imports
import axios, { AxiosPromise } from 'axios'
// Personal imports
import { getProgramApplications } from '#stores'
import { programItem } from '../fixtures/zanox'
describe('Zanox sales', async function () {
describe('Get program applications', async function () {
it('should retrieve program applications', async function () {
const program = programItem()
const mock = jest.spyOn(axios, 'get')
mock.mockReturnValueOnce({ data: [program] } as unknown as AxiosPromise<unknown>)
getProgramApplications(process.env.ZANOX_ADSPACE!)
})
})
})
This section pertains to my package.json
:
{
"name": "zanox",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
// More configurations go here...
}
Lastly, we have the tsconfig.json
file:
{
"compilerOptions": {
"baseUrl": ".",
// Additional options are listed here...
}
The issue I am encountering involves compilation errors when attempting to build my project. The terminal output displays errors related to variable declarations within the type definitions of Mocha and Jest. I have thoroughly reviewed discussions recommending upgrades to the typescript
version and removal of jasmine
, even though my project does not utilize jasmine and is already using the latest typescript
version. Why am I experiencing this problem?