Meta tags:
description= Which @angular/* package(s) are the source of the bug? build Is this a regression? No Description With the @angular/build:karma builder (esbuild), a standalone component imported through a barrel (export * from ./x ) can be undefined in...;
Headings (most frequently used words):
navigation, karma, is, of, description, metadata, footer, the, nagahara, naoki, commented, on, nov, 2026, builder, component, imported, through, barrel, undefined, in, testbed, when, another, spec, has, an, async, test, cross, chunk, lazy, init, counterpart, 33728, 34250, menu, repository, activity, issue, actions, which, angular, package, are, source, bug, this, regression, minimal, reproduction, exception, or, error, your, environment, anything, else, relevant, assignees, labels, type, projects, milestone, relationships, development,
Text of the page (most frequently used words):
the (67), #component (32), angular (29), and (23), test (21), spec (21), build (18), layout (18), with (17), karma (17), from (16), app (15), github (14), testbed (14), imports (14), barrel (13), async (12), import (12), that (11), for (11), formlayoutcomponent (10), src (10), chunk (10), this (9), specs (9), undefined (9), code (9), form (9), 2026 (8), dialog (8), builder (8), dialogcomponent (8), another (8), fix (7), testing (7), true (7), through (7), export (7), actions (6), has (6), other (6), core (6), consumer (6), security (5), copilot (5), issue (5), sign (5), still (5), page (5), only (5), your (5), configuretestingmodule (5), pagecomponent (5), lazy (5), you (4), not (4), projects (4), regression (4), all (4), reproduction (4), nov (4), nagahara (4), naoki (4), while (4), shared (4), splitting (4), disablecodesplitting (4), directly (4), two (4), unit (4), when (4), initialiser (4), zone (4), tsconfig (4), json (4), counterpart (4), 33728 (4), imported (4), support (4), can (3), navigation (3), open (3), needstriage (3), milestone (3), area (3), one (3), pass (3), more (3), across (3), application (3), options (3), then (3), cannot (3), read (3), properties (3), reading (3), ɵcmp (3), run (3), main (3), oct (3), same (3), vitest (3), 33729 (3), which (3), include (3), cli (3), tobetruthy (3), componentinstance (3), createcomponent (3), expect (3), creates (3), describe (3), class (3), template (3), selector (3), its (3), calls (3), bundle (3), what (3), copy (3), link (3), 34250 (3), cross (3), init (3), quality (3), tab (3), window (3), refresh (3), session (3), reload (3), developers (3), changelog (3), customer (3), enterprise (3), grade (3), features (3), community (2), status (2), footer (2), pull (2), requests (2), development (2), yet (2), type (2), labels (2), metadata (2), already (2), opened (2), integration (2), including (2), contributor (2), commented (2), before (2), consuming (2), decorator (2), state (2), working (2), four (2), fail (2), environment (2), errors (2), current (2), entry (2), need (2), call (2), first (2), result (2), both (2), local (2), failed (2), add (2), callback (2), used (2), third (2), standalone (2), reproduced (2), arm64 (2), node (2), added (2), robot (2), like (2), disable (2), builds (2), project (2), full (2), suite (2), but (2), looks (2), package (2), esbuild (2), testbedcompiler (2), error (2), below (2), removing (2), total (2), success (2), await (2), index (2), content (2), module (2), target (2), files (2), everything (2), passes (2), chunks (2), itself (2), own (2), becomes (2), init_form_layout_component (2), emitted (2), __esm (2), require_x_spec (2), fails (2), are (2), description (2), source (2), new (2), insights (2), 196 (2), repository (2), signed (2), universe (2), training (2), integrations (2), stories (2), center (2), documentation (2), learn (2), business (2), fixes (2), products (2), secret (2), perform, action, time, share, personal, information, manage, cookies, contact, docs, privacy, terms, inc, branches, none, relationships, due, date, assigned, assignees, comment, have, account, join, conversation, free, tests, 34668, investigating, ensures, initialized, evaluates, preserving, implementation, finalized, once, validated, plan, submit, please, let, know, anyone, guidance, preferred, approach, also, tried, alone, hypothesis, disabling, duplicates, points, trace, fully, inittestenvironment, pnpm, bazel, packages, karma_integration_tests, config, sharding, test_output, matches, report, throwing, ran, successful, together, fourth, uses, create, exports, adapted, above, into, against, macos, chrome, headless, 159, 2c6e8b970, activity, applying, seems, natural, did, real, showed, failing, mixed, folders, passed, happened, decided, outcome, haven, doesn, set, does, since, path, unchanged, runners, anything, else, relevant, manager, npm, darwin, typescript, typeerror, getcomponentdef2, isstandalonecomponent, queuetypesfrommodulesarrayrecur, queuetypesfrommodulesarray, _testbedimpl, exception, gives, resolve, promise, importer, identical, consumers, again, extends, types, jasmine, preserve, es2022, importhelpers, experimentaldecorators, isolatedmodules, skiplibcheck, strict, compileroptions, chromeheadless, browsers, polyfills, architect, sourceroot, root, projecttype, repro, version, eight, small, watch, false, minimal, single, inlined, they, land, different, importing, without, condition, trigger, conditions, each, toggled, evaluated, array, literal, keeps, good, even, though, binding, defined, moment, later, never, just, placed, contains, commonjs, here, includes, behind, var, __commonjs, default, happens, mechanism, initialisers, plus, fixed, setting, runner, bundles, enabled, affected, builders, application_builder, inside, throws, whether, depends, subset, way, around, part, bug, body, fabiofigrod, items, issues, message, dismiss, alert, switched, accounts, out, appearance, settings, search, pricing, event, talks, workshops, next, partners, about, company, forum, events, webinars, blog, resource, connect, resources, premium, advanced, ons, trust, why, evaluate, see, industries, government, manufacturing, financial, services, healthcare, industry, nonprofits, startups, team, enterprises, stage, businesses, latest, improvements, place, developer, articles, sponsors, trending, repos, explore, customize, certifications, scanning, leak, prevention, protection, vulnerability, detection, remediation, secure, cloud, environments, codespaces, analysis, enforcement, automation, ship, coding, agent, tasks, automated, work, hosting, review, collaboration, platform, menu, skip,
Text of the page (random words):
karma builder component imported through a barrel is undefined in testbed when another spec has an async test cross chunk lazy init karma counterpart of 33728 issue 34250 angular angular cli github skip to content navigation menu sign in products platform github repository hosting code review and collaboration copilot ai coding agent for tasks projects and automated work build ship actions ci cd and automation code quality quality analysis fixes and enforcement codespaces cloud development environments secure code security vulnerability detection and remediation secret protection secret scanning and leak prevention all features developers learn documentation training certifications build build with copilot customize copilot integrations explore trending repos github sponsors developer articles changelog changelog your source for the latest features improvements and fixes across github products all in one place businesses by stage enterprises team startups nonprofits by industry healthcare financial services manufacturing government see all industries evaluate github why github customer stories business insights trust center add ons github advanced security enterprise grade code security copilot for business enterprise grade ai features premium support enterprise grade 24 7 support resources learn connect documentation resource center blog events webinars community forum customer stories integrations support customer support training github status company about partners changelog github universe github universe the event for developers by developers talks workshops and what s next for github pricing search sign in sign up appearance settings you signed in with another tab or window reload to refresh your session you signed out in another tab or window reload to refresh your session you switched accounts on another tab or window reload to refresh your session dismiss alert message angular angular cli repository navigation code issues 196 196 pull requests 19 19 actions security and quality 8 8 insights more items karma builder component imported through a barrel is undefined in testbed when another spec has an async test cross chunk lazy init karma counterpart of 33728 34250 new issue copy link new issue copy link open open karma builder component imported through a barrel is undefined in testbed when another spec has an async test cross chunk lazy init karma counterpart of 33728 34250 copy link labels area angular build milestone needstriage description fabiofigrod opened on oct 3 2026 issue body actions which angular package s are the source of the bug build is this a regression no description with the angular build karma builder esbuild a standalone component imported through a barrel export from x can be undefined inside another component s imports testbed then throws cannot read properties of undefined reading ɵcmp whether it fails depends only on which other spec files are part of the same test bundle the full suite of a project can pass while a subset include fails or the other way around this looks like the karma counterpart of 33728 the mechanism is the same shared chunks lazy __esm initialisers and a spec with an async test plus zone js 33729 fixed that one by setting disablecodesplitting for the vitest runner of angular build unit test src builders karma application_builder ts on main still bundles with code splitting enabled so the karma builder is still affected what happens in the emitted bundle a spec that contains an async test callback is emitted as commonjs var require_x_spec __commonjs export default require_x_spec everything it imports becomes a lazy __esm initialiser here that includes the component behind the barrel init_form_layout_component the barrel module index ts just export is placed in its own chunk that chunk is what calls init_form_layout_component the chunk with the consuming component dialogcomponent shared by two specs imports the component s chunk directly but not the barrel s chunk it never calls the initialiser itself the spec entry imports the consumer s chunk before the barrel s chunk the consumer s component imports formlayoutcomponent decorator is evaluated while formlayoutcomponent is still undefined the array literal keeps that undefined for good even though the binding becomes defined a moment later trigger conditions each toggled on its own in the reproduction below condition without it another spec in the bundle has an async test and imports the component directly removing async from b other spec ts 4 4 pass the consumer imports the component through a barrel importing from layout form layout component passes the consumer then calls the initialiser itself the consumer is shared by 2 specs and the barrel by 3 so they land in different chunks with a single consumer spec everything is inlined and passes minimal reproduction eight small files run with ng test watch false angular json test target only version 1 projects repro projecttype application root sourceroot src architect test builder angular build karma options polyfills zone js zone js testing tsconfig tsconfig spec json browsers chromeheadless tsconfig json compileroptions strict true skiplibcheck true isolatedmodules true experimentaldecorators true importhelpers true target es2022 module preserve tsconfig spec json extends it with types jasmine and include src ts src app layout form layout component ts import component from angular core component selector app form layout template ng content export class formlayoutcomponent src app layout index ts export from form layout component src app a dialog component ts import component from angular core import formlayoutcomponent from layout component selector app dialog imports formlayoutcomponent template app form layout dialog app form layout export class dialogcomponent src app a dialog component spec ts and src app a dialog again spec ts identical two consumers of dialogcomponent import testbed from angular core testing import dialogcomponent from dialog component describe dialogcomponent it creates testbed configuretestingmodule imports dialogcomponent expect testbed createcomponent dialogcomponent componentinstance tobetruthy src app c page component ts a third importer of the barrel and its spec import component from angular core import formlayoutcomponent from layout component selector app page imports formlayoutcomponent template app form layout page app form layout export class pagecomponent import testbed from angular core testing import pagecomponent from page component describe pagecomponent it creates testbed configuretestingmodule imports pagecomponent expect testbed createcomponent pagecomponent componentinstance tobetruthy src app b other spec ts the only spec with an async test it imports the component directly import testbed from angular core testing import formlayoutcomponent from layout form layout component describe other has an async test it creates the layout async testbed configuretestingmodule imports formlayoutcomponent await promise resolve expect testbed createcomponent formlayoutcomponent componentinstance tobetruthy result total 2 failed 2 success both dialogcomponent specs fail with the error below removing async and the await from other spec ts gives total 4 success exception or error typeerror cannot read properties of undefined reading ɵcmp at getcomponentdef2 at isstandalonecomponent at queuetypesfrommodulesarrayrecur at testbedcompiler queuetypesfrommodulesarray at testbedcompiler configuretestingmodule at _testbedimpl configuretestingmodule your environment angular cli 20 3 32 node 24 12 0 package manager npm 11 6 2 os darwin arm64 angular 20 3 16 angular build 20 3 16 esbuild 0 25 9 typescript 5 8 3 zone js 0 15 1 anything else relevant i reproduced it on 20 3 16 i haven t run it on 22 x but on main the karma builder still doesn t set disablecodesplitting only unit test runners vitest build options ts does since fix angular build disable code splitting for unit test builds 33729 the code path looks unchanged in a real project this showed up as 3 5 component specs failing only when include mixed two folders while the full suite passed which spec happened to call the initialiser first decided the outcome applying the same disablecodesplitting true to the karma application build seems like the natural fix as fix angular build disable code splitting for unit test builds 33729 did for vitest activity angular robot added area angular build on oct 3 2026 angular robot added this to the needstriage milestone on oct 3 2026 nagahara naoki commented on nov 7 2026 nagahara naoki on nov 7 2026 contributor more actions hi i reproduced this against current main 2c6e8b970 on macos arm64 with node js 24 22 2 and chrome headless 159 i adapted the reproduction above into a local karma builder integration test create a standalone layout component and a barrel that re exports it import it through the barrel in a dialog component used by two specs and in a page component used by a third spec add a fourth spec that imports the layout directly and uses an async test callback run the four specs together through angular build karma the result matches the report 2 failed 2 successful with both dialog specs throwing cannot read properties of undefined reading ɵcmp i ran the local regression with pnpm bazel test packages angular build karma_integration_tests config no sharding test_output errors i also tried disablecodesplitting true in the karma application build options that alone is not a working fix the four specs then fail with testing environment errors including need to call testbed inittestenvironment first my current hypothesis is that disabling splitting duplicates angular testing state across entry points i still need to trace this fully i m investigating a fix that ensures the component is initialized before the consuming decorator evaluates while preserving shared angular testing state across specs the implementation is not finalized yet once validated i plan to submit a pr with the fix and a regression test please let me know if anyone is already working on this or has guidance on the preferred approach nagahara naoki commented on nov 7 2026 nagahara naoki on nov 7 2026 contributor more actions i ve opened 34668 with a fix and a regression test all 42 karma integration tests pass including the reproduction sign up for free to join this conversation on github already have an account sign in to comment metadata metadata assignees no one assigned labels area angular build type no type projects no projects milestone needstriage no due date relationships none yet development no branches or pull requests issue actions open in github copilot app footer 2026 github inc footer navigation terms privacy security status community docs contact manage cookies do not share my personal information you can t perform that action at this time
|