{"id":17605564,"url":"https://github.com/trion-development/docker-ng-cli-karma","last_synced_at":"2025-03-02T16:16:11.428Z","repository":{"id":39459042,"uuid":"80321100","full_name":"trion-development/docker-ng-cli-karma","owner":"trion-development","description":"Angular docker image capable of running Karma with Chrome","archived":false,"fork":false,"pushed_at":"2024-04-03T20:28:57.000Z","size":131,"stargazers_count":57,"open_issues_count":0,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-03T21:36:52.088Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trion-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-01-29T00:44:55.000Z","updated_at":"2024-04-14T20:31:00.413Z","dependencies_parsed_at":"2023-10-27T22:39:40.165Z","dependency_job_id":"64448457-3a53-49d6-98ae-d11ee6c5311c","html_url":"https://github.com/trion-development/docker-ng-cli-karma","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trion-development%2Fdocker-ng-cli-karma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trion-development%2Fdocker-ng-cli-karma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trion-development%2Fdocker-ng-cli-karma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trion-development%2Fdocker-ng-cli-karma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trion-development","download_url":"https://codeload.github.com/trion-development/docker-ng-cli-karma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241533628,"owners_count":19977826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-22T15:01:14.965Z","updated_at":"2025-03-02T16:16:11.419Z","avatar_url":"https://github.com/trion-development.png","language":"Dockerfile","readme":"# docker-ng-cli-karma\n\nDocker container to run Karma tests with Angular CLI inside Docker using Xvfb\n\nThis image is sponsored and maintained by https://www.trion.de/ - trion offers commercial training and consulting for all things Docker and Angular.\n\n## Example usage\n```\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng new MyDemo\ncd MyDemo\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng serve --host 0.0.0.0\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng serve --host :: #ipv6\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng build\n```\n\nIf you want to clone additional git repositories, f.e. from package.json, and you run with a different user than uid 1000 you need to mount the passwd since git requires to resolve the uid.\n\n```\ndocker run -u $(id -u) --rm -p 4200:4200 -v /etc/passwd:/etc/passwd -v \"$PWD\":/app trion/ng-cli npm install\n```\n\n\n## Running karma unit tests in docker container\n```\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng test\n```\n\n## Running karma unit tests in docker container, exiting after test run\n```\ndocker run -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng test --watch false\n```\n\n## Using WebGL\nWebGL is supported using Mesa software rendering. Since this is much slower it is not enabled by default.\n\nIn order to use the WebGL configuration, you need to use `xvfb-chromium-webgl` instead of using the regular chromium wrapper, called as `chrome` or `chromium`.\n\nThat wrapper has the additional switches `--enable-webgl --ignore-gpu-blacklist` enabled, which are required for software WebGL rendering.\n\nThis can be configured in the karma configuration, f.e.\n\n```\nbrowsers: ['/usr/bin/xvfb-chromium-webgl'],\n```\n\nor you can specify the chrome excutable using the `CHROME_BIN` environment variable like\n\n```\ndocker run -e CHROME_BIN=/usr/bin/xvfb-chromium-webgl -u $(id -u) --rm -v \"$PWD\":/app trion/ng-cli-karma ng test --watch false\n```\n\n## Interactive debugging\nInstead of running on the hidden Xvfb, you can also run the provided Chrome on a real display.\nTo do so you need to export the display, bind the /tmp sockets, and select the provided `display-chromium`\nstartup wrapper via the `CHROME_BIN` environment variable:\n\n```\ndocker run -e DISPLAY=:0 -e CHROME_BIN=/usr/bin/display-chromium -u $(id -u) --rm -v /tmp:/tmp -v \"$PWD\":/app trion/ng-cli-karma ng test\n```\n\nIf you forget to expose the /tmp/.X* socket you'll get an error message like:\n```\nERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!\n```\n\n## What about *-headless browsers\nMozilla Firefox and Google Chrome are in the process to provide headless browsers capable of executing integration tests.\n\nCurrently WebGL needs the mesa software renderer for Chrome, but it will change to the swift renderer, see https://bugs.chromium.org/p/chromium/issues/detail?id=617551\n\nMozilla is still working on headless support in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1338004\n\n## What if tests are not running (reliably)\nRun the tests in interactive debugging mode (see above) and check the browser console.\n\nIf there are errors like `Failed to load resource: net::ERR_INSUFFICIENT_RESOURCES` or `An error was thrown in afterAll Error: Can't find ./some-file.ts] (required by other-file.ts) at require` it may be that the browser is running out of shared memory. Try to either increase the shared memory with the docker parameter `--shm-size 1G` or disable shared memory usage by specifying the flag `--disable-dev-shm-usage` for Chromium/Chrome.\n\n","funding_links":[],"categories":["Testing"],"sub_categories":["Component"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrion-development%2Fdocker-ng-cli-karma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrion-development%2Fdocker-ng-cli-karma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrion-development%2Fdocker-ng-cli-karma/lists"}