karma-runner / karma-runner/karma

Feature Request: Introduce a "bundle" step in the file processing pipeline.

Open
#3,633 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Tests and app code get through a pipeline in Karma:

1. They are determined (wildcard resolution).
2. They are loaded into memory (and cache).
3. Watching is set up (if enabled).
4. They undergo preprocessing.
5. They are inserted in the respective `context.html` template expansion.
6. They are served.

Preprocessing takes in a file and modifies it (i.e. input: 1 file; output: 1 file). However, this pipeline misses a step that offers a lot of potential: bundling. After preprocessing (between 3 and 4), bundling would get as input the preprocessed files and output other files (not necessarily in a 1:1 relationship).

Bundling could be used for:

- Splitting large script files. This has been a need in our tests on Karma, as frequently big scripts mess up with the event loop and memory.
- Packing/chunking scripts for lazy loading (https://webpack.js.org/guides/code-splitting/).

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named in the issue. Start by tracing Karma's file-processing pipeline and compare the proposed post-preprocessing bundling stage with the linked webpack code-splitting guide; done means defining and implementing a supported bundling step that can transform preprocessed files into one or more served files.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.