mirror of
https://github.com/simoneb/axios-hooks.git
synced 2025-12-08 21:25:56 +00:00
* build: initial TypeScript migration Add TypeScript as a dev dependency Configure Babel to handle .ts and .tsx files Add basic TSConfig for starting type checking Convert src index file to .ts * chore: make __ssrPromises mutable in index.d.ts Change __ssrPromises from const to let in index.d.ts to fix the build error: SyntaxError: Missing initializer in const declaration This allows __ssrPromises to be initialized later instead of requiring an initializer when declared. * feat: add typescript types and interfaces Add typescript type definitions: AxiosHooksConfig - configuration options UseAxiosCache - cache object type UseAxiosOptions - hook options interface UseAxiosResponse - custom response type UseAxiosResult - hook return type This provides typed interfaces for the different configurations, options, and results when using the hooks. Ensures correct TS usage and enables editor auto-complete. * test: migrate tests to typescript Remove JavaScript test files Convert remaining tests to TypeScript Update Jest config to only run TS tests Remove no longer needed type declaration files Update tests to properly mock axios as a typed mock Fix minor type errors in tests Add types to test utilities This finishes migration of the tests to TypeScript for improved compile time checking and takes full advantage of TypeScript in the tests.
24 lines
490 B
JavaScript
24 lines
490 B
JavaScript
const commonOptions = {
|
|
resetMocks: true,
|
|
coverageDirectory: 'coverage'
|
|
}
|
|
|
|
const projects = [
|
|
{
|
|
displayName: 'ts',
|
|
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
|
|
preset: 'ts-jest/presets/js-with-ts',
|
|
testEnvironment: 'jsdom'
|
|
},
|
|
{
|
|
displayName: 'ssr-ts',
|
|
testMatch: ['**/?(*.)+(spec|test).ssr.ts?(x)'],
|
|
preset: 'ts-jest/presets/js-with-ts',
|
|
testEnvironment: 'node'
|
|
}
|
|
]
|
|
|
|
module.exports = {
|
|
projects: projects.map(p => ({ ...p, ...commonOptions }))
|
|
}
|