2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00
Files
axios/tests/module/esm/tests/ts.module.test.js
T
Atharva Singh 694f1eca8c fix: transformRequest input typing (#10745)
* fix(types): type transformRequest input data

* chore: imrpove testing and overall posture

* fix:f failing tests

---------

Co-authored-by: Jay <jasonsaayman@gmail.com>
2026-04-26 10:03:20 +02:00

37 lines
1.2 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: {
target: 'es2016',
module: 'commonjs',
moduleResolution: 'node',
esModuleInterop: true,
strict: true,
skipLibCheck: true,
},
};
describe('module ts compatibility', () => {
it('compiles and executes import axios syntax', () => {
const sourcePath = path.join(repoRoot, 'tests/module/esm/tests/helpers/esm-functions.ts');
const fixturePath = createTempFixture(suiteRoot, null, 'ts', sourcePath, tsconfig, {
type: 'commonjs',
});
try {
runCommand('node', [tscBin, '-p', 'tsconfig.json'], { cwd: fixturePath });
runCommand('node', ['index.js'], { cwd: fixturePath });
} finally {
cleanupTempFixture(fixturePath);
}
});
});