Skip to content

ci: add CodeQL, formatting check and unit tests - #59

Open
BKPepe wants to merge 2 commits into
openwrt:developfrom
BKPepe:add-tests
Open

ci: add CodeQL, formatting check and unit tests#59
BKPepe wants to merge 2 commits into
openwrt:developfrom
BKPepe:add-tests

Conversation

@BKPepe

@BKPepe BKPepe commented Aug 5, 2026

Copy link
Copy Markdown
Member

This adds a lightweight CI setup with CodeQL and prettier and a few unit tests.

BKPepe added 2 commits August 5, 2026 04:13
Trailing whitespace, blank lines and YAML quoting only, so the
formatting check starts from a clean slate. No content changes.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
CodeQL scans master and pull requests. Prettier runs via npx with the
version pinned in the workflow, and the tests use the built-in
node:test runner, so the repo needs no package.json or lockfile.

The tests load toh_main.js in a vm context with stubbed browser
globals and exercise the pure helpers.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Copilot AI lite review requested due to automatic review settings August 5, 2026 02:20
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a lightweight CI setup (formatting check, unit tests, and CodeQL) and adds initial Node-based tests for selected helper functions in static/js/toh_main.js.

Changes:

  • Add a CI workflow that runs Prettier checks and node --test.
  • Add a CodeQL workflow plus a repo-specific CodeQL config.
  • Add unit tests that execute static/js/toh_main.js in a Node vm context with minimal browser globals.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/toh_main.test.js Adds unit tests for several helper functions in toh_main.js.
tests/helpers/load-toh-main.js Provides a VM-based loader to execute the browser script in Node tests.
README.md Minor whitespace/formatting cleanup.
.prettierrc.json Adds Prettier config (tabs).
.prettierignore Excludes vendored/upstream files from Prettier checks.
.github/workflows/release.yml Minor formatting adjustments.
.github/workflows/release-test.yml Minor formatting adjustments.
.github/workflows/codeql.yml Adds CodeQL workflow.
.github/workflows/ci.yml Adds CI workflow for formatting + tests.
.github/codeql/codeql-config.yml Adds CodeQL paths-ignore config for vendored bundles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/toh_main.test.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants