eslint-plugin: fix tests not restoring cwd

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-01-26 10:12:50 +01:00
parent 65a8564a2d
commit e93bc4fc13
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({