feat: copy output easily. also build fixes.

This commit is contained in:
2026-02-23 12:07:19 +01:00
parent caa3f3c061
commit bf945716f9
12 changed files with 135 additions and 7 deletions

View File

@@ -253,6 +253,40 @@ describe('Panel', () => {
expect(screen.getByText('hello from script')).toBeInTheDocument();
});
it('copies output entries from output tab with copy button', async () => {
const writeText = vi.fn().mockResolvedValue(undefined);
Object.defineProperty(globalThis, 'navigator', {
value: { clipboard: { writeText } },
configurable: true,
});
useAppStore.setState({
panelActiveTab: 'output',
panelOutputEntries: [
{
id: 'output-1',
message: 'pyodide.asm.js missing',
createdAt: '2026-02-22T00:00:00.000Z',
kind: 'error',
},
{
id: 'output-2',
message: 'second line',
createdAt: '2026-02-22T00:00:01.000Z',
kind: 'stdout',
},
],
});
render(<Panel />);
fireEvent.click(screen.getByRole('button', { name: 'Copy Output' }));
await vi.waitFor(() => {
expect(writeText).toHaveBeenCalledWith('pyodide.asm.js missing\n\nsecond line');
});
});
it('renders grouped tasks as expandable parent rows with child task names in tasks tab', async () => {
useAppStore.setState({
tasks: [

View File

@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest';
import { resolvePyodideIndexURL } from '../../../src/renderer/python/pyodideAssetUrl';
describe('resolvePyodideIndexURL', () => {
it('resolves to packaged node_modules path for dist worker urls', () => {
const workerUrl = 'file:///Applications/bDS.app/Contents/Resources/app.asar/dist/renderer/assets/pythonRuntime.worker-abc123.js';
expect(resolvePyodideIndexURL(workerUrl)).toBe(
'file:///Applications/bDS.app/Contents/Resources/app.asar/node_modules/pyodide/'
);
});
it('resolves to vite node_modules path for dev worker urls', () => {
const workerUrl = 'http://localhost:5173/src/renderer/python/pythonRuntime.worker.ts';
expect(resolvePyodideIndexURL(workerUrl)).toBe('http://localhost:5173/node_modules/pyodide/');
});
});