forked from functions-dev/ocp-console-plugin
-
Notifications
You must be signed in to change notification settings - Fork 3
SRVOCF-1007: Fix Monaco editor errors when loading JavaScript files #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
twoGiants
wants to merge
1
commit into
openshift:master
Choose a base branch
from
twoGiants:SRVOCF-1007-edit-page-shows-error-after-a-function-is-loaded
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ AGENTS.override.md | |
| .claude/pr/* | ||
| .mcp* | ||
| .tmp | ||
| .pi-subagents | ||
|
|
||
| # Editors | ||
| *.code-workspace | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../.claude/commands/create-pr.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../.claude/commands/pdf-transcription-demo.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Jira Bug Template | ||
|
|
||
| ``` | ||
| ### Summary | ||
|
|
||
| <One sentence describing what is broken and where.> | ||
|
|
||
| Every bug fix requires a regression test (see [Testing](../TESTING.md#approach)). | ||
|
|
||
| ### Steps to Reproduce | ||
|
|
||
| 1. <Step-by-step instructions to trigger the bug.> | ||
|
|
||
| ### Expected Behavior | ||
|
|
||
| <What should happen.> | ||
|
|
||
| ### Actual Behavior | ||
|
|
||
| <What happens instead. Include error messages, stack traces, or screenshots.> | ||
|
|
||
| ### Environment | ||
|
|
||
| <OCP version, browser, cluster type, or other relevant context.> | ||
|
|
||
| ### Root Cause (optional) | ||
|
|
||
| <Brief explanation of why it happens, if known.> | ||
|
|
||
| ### Fix (optional) | ||
|
|
||
| <Brief description of the fix, if known.> | ||
|
|
||
| ### References | ||
|
|
||
| <Links to code, logs, screenshots, recordings, related issues.> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { test, expect } from '../../fixtures/authenticated-page'; | ||
| import { navigateToEditPage } from '../../helpers/navigation'; | ||
| import { PRESEEDED_FUNC_NAME } from '../../mocks/github'; | ||
|
|
||
| test.describe('Edit JavaScript function', () => { | ||
| test('regression SRVOCF-1007: editor loads JS files without Monaco worker errors', async ({ | ||
| page, | ||
| }) => { | ||
| const consoleErrors: string[] = []; | ||
| page.on('pageerror', (err) => consoleErrors.push(err.message)); | ||
|
|
||
| await test.step('navigate to edit page', async () => { | ||
| await navigateToEditPage(page, PRESEEDED_FUNC_NAME); | ||
| await expect(page.getByRole('heading', { name: 'Edit function' })).toBeVisible({ | ||
| timeout: 10_000, | ||
| }); | ||
| }); | ||
|
|
||
| await test.step('verify editor loads with JavaScript syntax highlighting', async () => { | ||
| const editor = page.locator('.monaco-editor'); | ||
| await expect(editor.first()).toBeVisible({ timeout: 10_000 }); | ||
| await expect(editor.first()).toContainText('module.exports'); | ||
|
|
||
| // Language label shows JAVASCRIPT | ||
| await expect(page.getByText('JAVASCRIPT')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('verify no webpack error overlay appeared', async () => { | ||
| const overlay = page.locator('#webpack-dev-server-client-overlay'); | ||
| await expect(overlay).toHaveCount(0); | ||
| }); | ||
|
|
||
| await test.step('verify no "Unexpected usage" errors in console', async () => { | ||
| const workerErrors = consoleErrors.filter((msg) => msg.includes('Unexpected usage')); | ||
| expect(workerErrors).toHaveLength(0); | ||
| }); | ||
|
|
||
| await test.step('verify file tree loaded', async () => { | ||
| const tree = page.getByRole('tree', { name: 'File tree' }); | ||
| await expect(tree.getByText('func.yaml')).toBeVisible(); | ||
| await expect(tree.getByText('index.js')).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('verify switching files works without errors', async () => { | ||
| const tree = page.getByRole('tree', { name: 'File tree' }); | ||
| await tree.getByText('func.yaml', { exact: true }).click(); | ||
|
|
||
| const editor = page.locator('.monaco-editor'); | ||
| await expect(editor.first()).toContainText('runtime: node'); | ||
|
|
||
| // Switch back to JS file | ||
| await tree.getByText('index.js', { exact: true }).click(); | ||
| await expect(editor.first()).toContainText('module.exports'); | ||
|
|
||
| // Still no worker errors after switching | ||
| const workerErrors = consoleErrors.filter((msg) => msg.includes('Unexpected usage')); | ||
| expect(workerErrors).toHaveLength(0); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@twoGiants that seems like a reasonably addition to test coverage.