Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ packages/*/mvn/resources/
.scala-build/

.nx/

# Vitest artifacts (reports, attachments, failure screenshots)
.vitest/
# pack files
mutation-*.tgz

Expand Down
4 changes: 2 additions & 2 deletions packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@tailwindcss/forms": "0.5.11",
"@tailwindcss/vite": "4.3.3",
"@types/prismjs": "1.26.6",
"@vitest/browser-playwright": "4.1.11",
"@vitest/browser-playwright": "5.0.0",
"anser": "2.3.5",
"cross-env": "10.1.0",
"eslint": "catalog:",
Expand All @@ -73,6 +73,6 @@
"rxjs": "7.8.2",
"tailwindcss": "4.3.3",
"vite": "8.2.2",
"vitest": "4.1.11"
"vitest": "5.0.0"
}
}
19 changes: 10 additions & 9 deletions packages/elements/test/unit/components/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,16 @@ describe(MutationTestReportAppComponent.name, () => {
// noop
}

eventSourceConstructorStub = vi.spyOn(window, 'EventSource').mockImplementation(
class MockEventSource extends EventSource {
// @ts-expect-error - we are mocking the constructor
// eslint-disable-next-line @typescript-eslint/no-unused-vars
constructor(url: string | URL) {
return eventSource;
}
},
);
// Capture the real constructor before spying, otherwise the mock would extend itself
const OriginalEventSource = window.EventSource;
class MockEventSource extends OriginalEventSource {
// @ts-expect-error - we are mocking the constructor
// eslint-disable-next-line @typescript-eslint/no-unused-vars
constructor(url: string | URL) {
return eventSource;
}
}
eventSourceConstructorStub = vi.spyOn(window, 'EventSource').mockImplementation(MockEventSource);
sut = new CustomElementFixture('mutation-test-report-app', { autoConnect: false });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe(MutationTestReportDrawerTestComponent.name, () => {
it('should render the header correctly', async () => {
sut.element.test = test;
await sut.whenStable();
expect(sut.$('[slot="header"]')).toHaveTextContent('🌧 foo should bar [NotCovering]');
expect(sut.$('[slot="header"]')).toHaveTextContent('🌧 foo should bar [NotCovering] (2:1)');
});

it('should render closed by default', () => {
Expand Down Expand Up @@ -131,9 +131,9 @@ describe(MutationTestReportDrawerTestComponent.name, () => {
await sut.whenStable();
const listItems = sut.$$('[slot="detail"] ul li');
expect(listItems).lengthOf(3);
expect(listItems[0]).toHaveTextContent('🎯 const a = false');
expect(listItems[1]).toHaveTextContent('🎯 const b = true');
expect(listItems[2]).toHaveTextContent('☂️ if(1 <= 5)');
expect(listItems[0]).toHaveTextContent('🎯 const a = false (foo.js:1:1)');
expect(listItems[1]).toHaveTextContent('🎯 const b = true (foo.js:1:1)');
expect(listItems[2]).toHaveTextContent('☂️ if(1 <= 5) (foo.js:1:1)');
});

function detailText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('append.js');
expect(getActiveItem()).toHaveTextContent('append.js');
expect(sut.$$('#files li')).toHaveLength(3);
expect(sut.$('#files')).not.toHaveTextContent('No files found');
});
Expand All @@ -129,7 +129,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('index.ts');
expect(getActiveItem()).toHaveTextContent('index.ts');
});

it('should redirect to mutant when pressing enter', async () => {
Expand All @@ -155,7 +155,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('index.html');
expect(getActiveItem()).toHaveTextContent('index.html');
});

it('should show when no files are found', async () => {
Expand All @@ -180,7 +180,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('index.html');
expect(getActiveItem()).toHaveTextContent('index.html');
});

it('should move to the first item when pressing down on the last item', async () => {
Expand All @@ -191,7 +191,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('append.js');
expect(getActiveItem()).toHaveTextContent('append.js');
});

it('should move active item to the previous item when pressing up', async () => {
Expand All @@ -203,7 +203,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('index.html');
expect(getActiveItem()).toHaveTextContent('index.html');
});

it('should move to the last item when pressing up on the first item', async () => {
Expand All @@ -215,7 +215,7 @@ describe(MutationTestReportFilePickerComponent.name, () => {
await sut.whenStable();

// Assert
expect(getActiveItem()).toHaveTextContent('index.ts');
expect(getActiveItem()).toHaveTextContent('index.ts');
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe(MutationTestReportTestMetricsTable.name, () => {
const table = sut.$('table');
expect(table).ok;
expect(table.querySelector('[role=progressbar]')!.getAttribute('aria-valuenow')).contains(mutationScore);
expect(table.querySelector('.text-red-700')!).toHaveTextContent(mutationScore.toString());
expect(table.querySelector('.text-red-700')!).toHaveTextContent(mutationScore.toFixed(2));
});

it('should show no progress bar when score is NaN', async () => {
Expand Down
Loading