Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[support] Loading test data / assets in bundle #493

Open
thw0rted opened this issue Aug 23, 2021 · 0 comments
Open

[support] Loading test data / assets in bundle #493

thw0rted opened this issue Aug 23, 2021 · 0 comments

Comments

@thw0rted
Copy link

I'm trying to convert tests from karma-webpack to karma-typescript. One of the outstanding issues I have is that some tests load test data via Webpack loaders, and I'm not sure how to replicate that behavior with Karma. I'm pretty sure that this isn't a general Karma issue, though, but specific to the way karma-ts bundling works.

I asked a detailed version of the question here on SO, but briefly, I'm serving the assets with

// Karma config
files: [
  { pattern: "src/app/**/*.xml", served: true, included: false, watched: false },
]

I can hard-code the path as e.g. fetch("/base/src/app/some/module/dir/test-data/test1.xml"), but I'd rather either a) bundle the data during the build process, or b) compute the fetch path at runtime based on module metadata.

If it helps clarify, I put together a simple repro here which includes commented-out code showing what I did in Webpack.

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

No branches or pull requests

1 participant