Merge pull request #20587 from backstage/rugvip/cwdfix

create-app: fix for test not restoring cwd
This commit is contained in:
Patrik Oldsberg
2023-10-13 11:25:20 +02:00
committed by GitHub
@@ -103,6 +103,7 @@ describe('tasks', () => {
const mockDir = createMockDirectory();
const origCwd = process.cwd();
const realChdir = process.chdir;
// If anyone calls chdir then make it resolve within the tmpdir
const mockChdir = jest.spyOn(process, 'chdir');
@@ -130,6 +131,10 @@ describe('tasks', () => {
mockChdir.mockReset();
});
afterAll(() => {
realChdir(origCwd);
});
describe('checkAppExistsTask', () => {
it('should do nothing if the directory does not exist', async () => {
const dir = 'projects/';