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
11 changes: 8 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '14.x'
node-version: '20.x'
# Enable unprivileged user namespaces for Chrome sandbox
# This is required because Ubuntu 23.10+ disables them by default
# See: https://github.com/actions/runner-images/issues/9621
Copy link
Contributor

Choose a reason for hiding this comment

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

confused about this issue link here

- name: Enable user namespaces
run: sudo sysctl -w kernel.unprivileged_userns_clone=1
Comment on lines +15 to +16
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The approach is contradictory: the workflow enables user namespaces to support Chrome's sandbox (line 16), but the Karma config disables the sandbox entirely with --no-sandbox (line 30).

If user namespaces are enabled, the sandbox should work without needing --no-sandbox. Consider either:

  1. Remove the --no-sandbox flag and rely only on the sysctl setting
  2. Remove the sysctl step and rely only on --no-sandbox

The current implementation works but maintains both workarounds unnecessarily, which could be confusing for future maintainers.

Copilot uses AI. Check for mistakes.
- run: npm install
- run: npm run build --if-present
- run: npm test
Expand Down
25 changes: 23 additions & 2 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
process.env.CHROME_BIN = require('chromium').path
// Use system Chrome/Chromium if available, otherwise let Karma find it
// In CI environments, CHROME_BIN should be set or the system Chrome should be in PATH
if (!process.env.CHROME_BIN) {
try {
const chromiumPath = require('chromium').path
if (chromiumPath) {
process.env.CHROME_BIN = chromiumPath
}
} catch (e) {
// If chromium package doesn't work, let Karma use system Chrome
}
}

module.exports = function (config) {
config.set({
Expand All @@ -11,7 +22,17 @@ module.exports = function (config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['ChromeHeadless'],
browsers: ['ChromeHeadlessCI'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: [
'--no-sandbox',
'--disable-gpu',
'--disable-dev-shm-usage'
]
}
},
autoWatch: false,
singleRun: true,
concurrency: Infinity
Expand Down
Loading
Loading