Skip to content

Make background.js Node-safe and add test for default blocks editor mode#1

Open
rawritude wants to merge 1 commit intomainfrom
codex/create-and-run-tests-for-implementation
Open

Make background.js Node-safe and add test for default blocks editor mode#1
rawritude wants to merge 1 commit intomainfrom
codex/create-and-run-tests-for-implementation

Conversation

@rawritude
Copy link
Copy Markdown
Owner

Motivation

  • Allow background.js to be loaded in a Node test environment by avoiding runtime errors when Chrome APIs are absent.
  • Ensure buildSystemPrompt behavior is covered when editorMode is omitted so the system defaults to Blocks guidance.
  • Provide a simple test runner configuration so tests can be executed with node --test.

Description

  • Add a hasChromeRuntime check and wrap Chrome-specific listeners so background.js is safe outside Chrome.
  • Export buildSystemPrompt from background.js using module.exports for use in Node tests.
  • Add a minimal package.json with a test script (node --test) and update tests/background.test.js to include a new test that verifies default Blocks guidance when editorMode is omitted.

Testing

  • Ran npm test which invokes node --test.
  • All automated tests passed.
  • Test suite output: 4 tests passed and 0 failed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant