Merge pull request #22530 from backstage/rugvip/eslintfix

eslint-plugin: fix tests not restoring cwd
This commit is contained in:
Patrik Oldsberg
2024-01-26 10:33:12 +01:00
committed by GitHub
3 changed files with 15 additions and 0 deletions
@@ -25,6 +25,11 @@ const ERR = (name: string, path: string) => ({
message: `${name} does not export ${path}`,
});
// cwd must be restored
const origDir = process.cwd();
afterAll(() => {
process.chdir(origDir);
});
process.chdir(FIXTURE);
const ruleTester = new RuleTester({
@@ -28,6 +28,11 @@ const ERR_FORBIDDEN = (newImp: string) => ({
message: `Relative imports of monorepo packages are forbidden, use '${newImp}' instead`,
});
// cwd must be restored
const origDir = process.cwd();
afterAll(() => {
process.chdir(origDir);
});
process.chdir(FIXTURE);
const ruleTester = new RuleTester({
@@ -53,6 +53,11 @@ const ERR_SWITCH_BACK = () => ({
message: 'Switch back to import declaration',
});
// cwd must be restored
const origDir = process.cwd();
afterAll(() => {
process.chdir(origDir);
});
process.chdir(FIXTURE);
const ruleTester = new RuleTester({