mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
76794ac27a
* chore: add additional testing to esm and cjs smoke * test: updated test suite to include module tests * fix: esm test smoke import * fix: cubic feedback * fix: failing cjs * fix: cjs timeout
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { describe, it } from 'vitest';
|
|
import { createTempFixture, cleanupTempFixture } from './helpers/fixture.js';
|
|
import { runCommand } from './helpers/run-command.js';
|
|
|
|
const suiteRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const repoRoot = path.resolve(suiteRoot, '../../..');
|
|
const tscBin = path.join(suiteRoot, 'node_modules', 'typescript', 'bin', 'tsc');
|
|
|
|
const tsconfig = {
|
|
compilerOptions: {
|
|
checkJs: true,
|
|
module: 'node16',
|
|
},
|
|
};
|
|
|
|
describe('module esm typings compatibility', () => {
|
|
it('type-checks esm axios typings', () => {
|
|
const sourcePath = path.join(repoRoot, 'test/module/typings/esm/index.ts');
|
|
const fixturePath = createTempFixture(suiteRoot, 'typings-esm', sourcePath, tsconfig, {
|
|
type: 'module',
|
|
});
|
|
|
|
try {
|
|
runCommand('node', [tscBin, '--noEmit', '-p', 'tsconfig.json'], { cwd: fixturePath });
|
|
} finally {
|
|
cleanupTempFixture(fixturePath);
|
|
}
|
|
});
|
|
});
|