Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/jest/src/diagnostics/__tests__/report.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,21 @@ describe('createDiagnosticsAppender', () => {
});

it('never throws when the directory cannot be written', async () => {
// A folder below a regular file cannot be created on any platform. On
// Windows, `/dev/null/nope` is an ordinary folder at the drive root.
const file = path.join(projectRoot, 'file');
await fs.writeFile(file, '');
const diagnostics = createDiagnostics({ enabled: true });
const appender = createDiagnosticsAppender(diagnostics, {
projectRoot: '/dev/null/nope',
projectRoot: path.join(file, 'nope'),
id: 'unwritable',
});

diagnostics.mark('a');
expect(() => appender.flush()).not.toThrow();
diagnostics.mark('b');
await expect(appender.dispose()).resolves.toBeUndefined();
expect(await exists(appender.filePath)).toBe(false);
});
});

Expand Down