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/helpers/fixture.js
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

21 lines
693 B
JavaScript

import fs from 'node:fs';
import path from 'node:path';
export const createTempFixture = (suiteRoot, name, sourcePath, tsconfig, packageJson) => {
const tempRoot = fs.mkdtempSync(path.join(suiteRoot, `.tmp-module-${name}-`));
const source = fs.readFileSync(sourcePath, 'utf8');
fs.writeFileSync(path.join(tempRoot, 'index.ts'), source);
fs.writeFileSync(path.join(tempRoot, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
if (packageJson) {
fs.writeFileSync(path.join(tempRoot, 'package.json'), JSON.stringify(packageJson, null, 2));
}
return tempRoot;
};
export const cleanupTempFixture = (dirPath) => {
fs.rmSync(dirPath, { recursive: true, force: true });
};