2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00
Files
axios/tests/module/cjs/tests/ts-require-default.module.test.cjs
T
Jay d9b941c302 revert: transformrequest typing 10745 (#10810)
* Revert "chore: added clarifying docs for the type change (#10804)"

This reverts commit 25387ae1ce.

* Revert "fix: transformRequest input typing (#10745)"

This reverts commit 694f1eca8c.
2026-04-27 17:27:25 +02:00

34 lines
1.1 KiB
JavaScript

const path = require('path');
const { describe, it } = require('mocha');
const { createTempFixture, cleanupTempFixture } = require('./helpers/fixture.cjs');
const { runCommand } = require('./helpers/run-command.cjs');
const suiteRoot = path.resolve(__dirname, '..');
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-require-default compatibility', () => {
it('compiles and executes require("axios").default imports', () => {
const sourcePath = path.join(repoRoot, 'tests/module/cjs/tests/helpers/ts-require-default.ts');
const fixturePath = createTempFixture(suiteRoot, 'ts-require-default', sourcePath, tsconfig);
try {
runCommand('node', [tscBin, '-p', 'tsconfig.json'], { cwd: fixturePath });
runCommand('node', ['index.js'], { cwd: fixturePath });
} finally {
cleanupTempFixture(fixturePath);
}
});
});