Skip to content

Question: angular/karma/browser support #995

@tg-freigmbh

Description

@tg-freigmbh

Hello.

We tried to use testcontainers in an empty testproject. This worked fine. Next we tried to integrate testcontainers in an angular 19 project using the default karma/jasmine testbed combo. this did not work, there were suddenly dozens of errors from thirdparty modules printed.

./node_modules/@grpc/grpc-js/build/src/service-config.js:34:11-24 - Error: Module not found: Error: Can't resolve 'os' in 'G:\development\wingman-single-repository\ui\cloud-suite-frontend\node_modules\@grpc\grpc-js\build\src'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
        - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "os": false }

./node_modules/@grpc/grpc-js/build/src/subchannel-address.js:30:14-28 - Error: Module not found: Error: Can't resolve 'net' in 'G:\development\wingman-single-repository\ui\cloud-suite-frontend\node_modules\@grpc\grpc-js\build\src'

./node_modules/@grpc/grpc-js/build/src/subchannel-call.js:23:14-30 - Error: Module not found: Error: Can't resolve 'http2' in 'G:\development\wingman-single-repository\ui\cloud-suite-frontend\node_modules\@grpc\grpc-js\build\src'

./node_modules/@grpc/grpc-js/build/src/subchannel-call.js:24:11-24 - Error: Module not found: Error: Can't resolve 'os' in 'G:\development\wingman-single-repository\ui\cloud-suite-frontend\node_modules\@grpc\grpc-js\build\src'

We currently suspect this is due to the fact that in a fresh project tests are execute in a nodejs worker, but using a angular/karma config tests are executed in the browser.

Can testcontainers-node be configured in a way to run inside a browser environment or is this use case unsupported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions