Skip to content

Specific diff causes Error: Expected hunk header but reached end of diff #41

@JamesHenry

Description

@JamesHenry

Hi @MrWangJustToDo, thanks a lot for the super useful libraries.

For this patch:

diff --git a/apps/shop-e2e/src/homepage-header.spec.ts b/apps/shop-e2e/src/homepage-header.spec.ts index dbee1cf..32b7f7f 100644 --- a/apps/shop-e2e/src/homepage-header.spec.ts +++ b/apps/shop-e2e/src/homepage-header.spec.ts @@ -2,29 +2,29 @@ import { test, expect } from '@playwright/test';

test('displays homepage with correct heading', async ({ page }) => {
await page.goto('/');

  • await expect(page.locator('h2').first()).toContainText('Legit Products');
  • await expect(page.locator('h2').first()).toContainText('Featured Products');
    });

test('product grid is displayed on homepage', async ({ page }) => {
await page.goto('/');

// Wait for product grid to load
await expect(page.locator('section').first()).toBeVisible();
});

test('filter buttons are functional', async ({ page }) => {
await page.goto('/');

const latestButton = page.getByRole('button', { name: 'Latest' });
const popularButton = page.getByRole('button', { name: 'Popular' });
const saleButton = page.getByRole('button', { name: 'Sale' });

await expect(latestButton).toBeVisible();
await expect(popularButton).toBeVisible();
await expect(saleButton).toBeVisible();

await latestButton.click();
await popularButton.click();
await saleButton.click();
-});
\ No newline at end of file
+});
diff --git a/apps/shop-e2e/src/homepage.spec.ts b/apps/shop-e2e/src/homepage.spec.ts
index dbee1cf..32b7f7f 100644
--- a/apps/shop-e2e/src/homepage.spec.ts
+++ b/apps/shop-e2e/src/homepage.spec.ts
@@ -2,29 +2,29 @@ import { test, expect } from '@playwright/test';

test('displays homepage with correct heading', async ({ page }) => {
await page.goto('/');

  • await expect(page.locator('h2').first()).toContainText('Legit Products');
  • await expect(page.locator('h2').first()).toContainText('Featured Products');
    });

test('product grid is displayed on homepage', async ({ page }) => {
await page.goto('/');

// Wait for product grid to load
await expect(page.locator('section').first()).toBeVisible();
});

test('filter buttons are functional', async ({ page }) => {
await page.goto('/');

const latestButton = page.getByRole('button', { name: 'Latest' });
const popularButton = page.getByRole('button', { name: 'Popular' });
const saleButton = page.getByRole('button', { name: 'Sale' });

await expect(latestButton).toBeVisible();
await expect(popularButton).toBeVisible();
await expect(saleButton).toBeVisible();

await latestButton.click();
await popularButton.click();
await saleButton.click();
-});
\ No newline at end of file
+});

Error: Expected hunk header but reached end of diff is thrown, I believe during DiffFile init.

You can reproduce by just applying the above diff to your playground: https://mrwangjusttodo.github.io/git-diff-view/?type=try

You can see how another patch visualizer tool does not have a problem with it, so I do not think there is an issue with the diff itself:

https://scrapfly.io/web-scraping-tools/patch-viewer

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions