2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Fix/typescript tests (#5375)

* chore(ci): Add release-it script;

* chore(ci): add `release:no-npm` script to release the package without making an npm release;

* fix(test): fixed `d.ts` typings;
refactor(test): refactor typescript tests;
This commit is contained in:
Dmitriy Mozgovoy
2022-12-14 22:49:49 +02:00
committed by GitHub
parent f2547d0e03
commit 7a2f901f42
11 changed files with 308 additions and 149 deletions
+46
View File
@@ -14,6 +14,16 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const exec = util.promisify(cp.exec);
const spawn = (command, args) => new Promise((resolve, reject) => {
cp.spawn(command, args, {
shell : true,
stdio: 'inherit'
}).once('error', reject).on(
'close',
(code) => code ? reject(new Error(`Exit code ${code}`)) : resolve()
);
});
const {Axios} = axiosFactory;
const ignoreList = ['default'];
@@ -134,4 +144,40 @@ describe('module', function () {
await exec(`npm test --prefix ${pkgPath}`, {});
});
});
describe('typings', () => {
describe('ESM', ()=> {
const pkgPath = path.join(__dirname, './typings/esm');
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
});
it('should pass types check', async function () {
this.timeout(30000);
await spawn(`npm test --prefix ${pkgPath}`, [], {
shell : true,
stdio: 'pipe'
});
});
});
describe('CommonJS', ()=> {
const pkgPath = path.join(__dirname, './typings/cjs');
after(async ()=> {
await remove(path.join(pkgPath, './node_modules'));
});
it('should pass types check', async function () {
this.timeout(30000);
await spawn(`npm test --prefix ${pkgPath}`, [], {
shell : true,
stdio: 'pipe'
});
});
});
});
});