2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

fix(types): fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; (#5420)

This commit is contained in:
Dmitriy Mozgovoy
2023-01-06 02:02:08 +02:00
committed by GitHub
parent 8651bf17d4
commit 08119634a2
5 changed files with 250 additions and 231 deletions
+65 -62
View File
@@ -58,90 +58,93 @@ describe('module', function () {
await remove(BACKUP_PATH);
});
it('should have consistent ESM export', function () {
const namedExport = {};
const factoryExport = {};
describe('export', function () {
Object.entries(axiosFactory).forEach(([key, value]) => {
if(!utils.hasOwnProp(Axios, key) && !(key in instance) && ignoreList.indexOf(key) === -1) {
factoryExport[key] = value;
}
it('should have consistent ESM export', function () {
const namedExport = {};
const factoryExport = {};
Object.entries(axiosFactory).forEach(([key, value]) => {
if (!utils.hasOwnProp(Axios, key) && !(key in instance) && ignoreList.indexOf(key) === -1) {
factoryExport[key] = value;
}
});
Object.entries(axios).forEach(([key, value]) => {
key !== 'default' && ignoreList.indexOf(key) === -1 && (namedExport[key] = value);
});
assert.deepStrictEqual(namedExport, factoryExport);
});
Object.entries(axios).forEach(([key, value]) => {
key!=='default' && ignoreList.indexOf(key) === -1 && (namedExport[key] = value);
describe('CommonJS', () => {
const pkgPath = path.join(__dirname, './cjs');
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
it('should be able to be loaded with require', async function () {
this.timeout(30000);
await exec(`npm test --prefix ${pkgPath}`);
});
});
assert.deepStrictEqual(namedExport, factoryExport);
});
describe('ESM', () => {
const pkgPath = path.join(__dirname, './esm');
describe('CommonJS', ()=> {
const pkgPath = path.join(__dirname, './cjs');
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
it('should be able to be loaded with import', async function () {
this.timeout(30000);
await exec(`npm test --prefix ${pkgPath}`);
});
});
it('should be able to be loaded with require', async function () {
this.timeout(30000);
describe('TS', () => {
const pkgPath = path.join(__dirname, './ts');
await exec(`npm test --prefix ${pkgPath}`);
});
});
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
describe('ESM', ()=> {
const pkgPath = path.join(__dirname, './esm');
it('should be able to be loaded with import', async function () {
this.timeout(30000);
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
it('should be able to be loaded with import', async function () {
this.timeout(30000);
describe('TS require(\'axios\')', () => {
const pkgPath = path.join(__dirname, './ts-require');
await exec(`npm test --prefix ${pkgPath}`);
});
});
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
describe('TS', ()=> {
const pkgPath = path.join(__dirname, './ts');
it('should be able to be loaded with require', async function () {
this.timeout(30000);
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
it('should be able to be loaded with import', async function () {
this.timeout(30000);
describe('TS require(\'axios\').default', () => {
const pkgPath = path.join(__dirname, './ts-require-default');
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
describe('TS require(\'axios\')', ()=> {
const pkgPath = path.join(__dirname, './ts-require');
it('should be able to be loaded with require', async function () {
this.timeout(30000);
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
});
it('should be able to be loaded with require', async function () {
this.timeout(30000);
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
describe('TS require(\'axios\').default', ()=> {
const pkgPath = path.join(__dirname, './ts-require-default');
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
});
it('should be able to be loaded with require', async function () {
this.timeout(30000);
await exec(`npm test --prefix ${pkgPath}`, {});
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
});