mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
d9b941c302
* Revert "chore: added clarifying docs for the type change (#10804)" This reverts commit25387ae1ce. * Revert "fix: transformRequest input typing (#10745)" This reverts commit694f1eca8c.
21 lines
693 B
JavaScript
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 });
|
|
};
|