Tests / @ogygia/barrels
@ogygia/barrels
Version 0.14.0 latest
620ddcca 94 test runs (94 tests, each run in Node, the browsers or both)
2.77× lines of test for each line of source (2,048 to 739) Only real test code counts: test files and their helpers, not fixtures, sample apps or benches.
Blank lines are left out on both sides.
Exactly what is counted
non-blank lines of test code across the repo (*.test.ts, *.test-d.ts, *.spec.ts, and the .ts helpers in test/ and e2e/ folders; no fixtures, fixture apps, stubs or benches), over non-blank lines of packages/*/src (no .d.ts or generated files)97.5% of source lines run by the tests
- 94Unit
- 0Browser
- 0End to end
- 0Type tests
- 0Lint rules
- 0Failing
Coverage
- 97.5%Lines
- 84.4%Branches
- 92.5%Functions
- 96.2%Statements
Every test
94 tests
| Test | Kind | Node | Chromium | Firefox | WebKit |
|---|---|---|---|---|---|
packages/barrels/test/barrel.test.ts | |||||
| cache + invalidation > a barrel edited while its map is being built is built again: no caller keeps the old map | Unit | pass | not run | not run | not run |
| cache + invalidation > a map is cached; invalidating a DEPENDENCY drops every map that walked through it | Unit | pass | not run | not run | not run |
| cache + invalidation > a nested barrel edited while the outer map walks through it is walked again | Unit | pass | not run | not run | not run |
| cache + invalidation > at scale: a 2 000-name barrel over 200 leaves maps in well under a second and points every name home | Unit | pass | not run | not run | not run |
| cache + invalidation > invalidating a leaf that turned impure re-classifies the chain on the next map | Unit | pass | not run | not run | not run |
| concurrency — what a real build does > many importers, many barrels, all at once: every name lands home | Unit | pass | not run | not run | not run |
| concurrency — what a real build does > two hundred importers asking for one barrel at once all get the SAME finished map (one build in flight) | Unit | pass | not run | not run | not run |
| concurrency — what a real build does > two walks that need each other (a → b while b → a is in flight) neither deadlock nor cache a hole | Unit | pass | not run | not run | not run |
| export map — the basic shapes > a .js barrel with .js-suffixed relative specifiers (nodenext style) resolves the same | Unit | pass | not run | not run | not run |
| export map — the basic shapes > export * as ns → a namespace leaf | Unit | pass | not run | not run | not run |
| export map — the basic shapes > import-then-export bindings resolve like direct re-exports | Unit | pass | not run | not run | not run |
| export map — the basic shapes > named, renamed, default-as-name, star: each name points at its leaf | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > a diamond — the same leaf reached by two paths — is NOT ambiguous | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > a nested barrel re-exporting a name its own star does not carry stays honest: unknown names are absent | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > a rename chain three barrels deep lands on the original leaf and name | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > a star into a nested pure barrel is transparent; into an impure module it stops there | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > cycles terminate: a ↔ b, and a barrel that stars itself | Unit | pass | not run | not run | not run |
| nesting — barrels of barrels > explicit re-exports win over stars; two stars with different leaves for one name are ambiguous | Unit | pass | not run | not run | not run |
| where the walk stops > a CommonJS module behind a star is opaque (module.exports is not an export list) | Unit | pass | not run | not run | not run |
| where the walk stops > a kept module in the MIDDLE of a chain is the leaf (the walk does not look through it) | Unit | pass | not run | not run | not run |
| where the walk stops > a package barrel is a candidate only when opted in (packages), then its exports map is walked | Unit | pass | not run | not run | not run |
| where the walk stops > a query id (?raw, ?url) is never a barrel; a re-export FROM a query id stays on the barrel | Unit | pass | not run | not run | not run |
| where the walk stops > a star into something unparsable (json, missing, a syntax error, virtual) makes the map OPAQUE, the rest still maps | Unit | pass | not run | not run | not run |
| where the walk stops > an impure module is left (said why) unless forced; forced keeps own names as own | Unit | pass | not run | not run | not run |
| where the walk stops > follow_packages: false makes a star into node_modules opaque; true walks it | Unit | pass | not run | not run | not run |
| where the walk stops > kept beats everything; a non-candidate is never walked; each map says why it is left | Unit | pass | not run | not run | not run |
packages/barrels/test/left-table.test.ts | |||||
| one table per build leg > a leg answers only what was said in it, and a leg that begins again forgets its last build's word | Unit | pass | not run | not run | not run |
| the barrel-left table > a component that could not be parsed explains every barrel it imports, joined by importer | Unit | pass | not run | not run | not run |
| the barrel-left table > a dependency's barrel is not explained by an unparsable importer (the pass never rewrites into it unasked) | Unit | pass | not run | not run | not run |
| the barrel-left table > a module transformed again forgets what it said before | Unit | pass | not run | not run | not run |
| the barrel-left table > answers the reasons recorded for a barrel, in a fixed order, once each | Unit | pass | not run | not run | not run |
| the barrel-left table > clear empties it (the end of a build leg, the dev server closing) | Unit | pass | not run | not run | not run |
| the barrel-left table > holds at most its cap of barrels: a new barrel past it is not recorded, a known one still is | Unit | pass | not run | not run | not run |
packages/barrels/test/left.test.ts | |||||
| each import the plugin leaves on its barrel is told, with the reason > ambiguous: two stars give the same name | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > impure: the barrel runs code of its own | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > kept: barrels({ keep }) lists it | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > namespace: the barrel is imported whole | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > opaque: a star into a module the index cannot read hides where a name lives | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > outside-project: a package that barrels({ packages }) does not list | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > own: the name is defined in the barrel itself (a forced impure barrel) | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > pinned: the import carries a region mark, so it stays as written | Unit | pass | not run | not run | not run |
| each import the plugin leaves on its barrel is told, with the reason > unparsable: a component the parser cannot read keeps every barrel it imports | Unit | pass | not run | not run | not run |
| what is not a barrel left behind says nothing > an import that moved, a plain module, a type-only or side-effect import, a name the barrel lacks | Unit | pass | not run | not run | not run |
| what the plugin said holds for its leg until the module or the leg begins again > a module transformed again forgets what it said before | Unit | pass | not run | not run | not run |
| what the plugin said holds for its leg until the module or the leg begins again > each leg answers for itself; a build leg that begins again drops its last build's word | Unit | pass | not run | not run | not run |
| what the plugin said holds for its leg until the module or the leg begins again > the dev server is one build: nothing is dropped when it starts | Unit | pass | not run | not run | not run |
packages/barrels/test/named-region.test.ts | |||||
| barrels + a marked named import > a region-MARKED barrel import is left to the compiler (skip policy) | Unit | pass | not run | not run | not run |
| barrels + a marked named import > barrels() beside ogygia() applies that rule end to end | Unit | pass | not run | not run | not run |
| barrels + a marked named import > INSIDE ogygia the marked import is left alone and a plain import of the same barrel is rewritten; the island id is the raw one | Unit | pass | not run | not run | not run |
| barrels + a marked named import > without the pass the marked named import compiles through the barrel | Unit | pass | not run | not run | not run |
packages/barrels/test/plugin.test.ts | |||||
| beside ogygia() > a specifier Vite cannot resolve (it THROWS from `this.resolve`) leaves that import alone and the rest still moves | Unit | pass | not run | not run | not run |
| beside ogygia() > leaves imports carrying the app's region-mark keys (custom importKeys too) as written, rewrites the rest | Unit | pass | not run | not run | not run |
| beside ogygia() > listed without ogygia(), it fails the build saying what to add | Unit | pass | not run | not run | not run |
| the report names the components it had to skip > skipped components are counted and listed, with or without rewrites | Unit | pass | not run | not run | not run |
| vite build > a `keep` matcher leaves that barrel alone even though it is pure | Unit | pass | not run | not run | not run |
| vite build > a package NOT opted in is left alone (dev pre-bundling safety) | Unit | pass | not run | not run | not run |
| vite build > the barrel and its unused leaves are not in the bundle; the used leaves are; the package barrel is bypassed too | Unit | pass | not run | not run | not run |
| vite build > the build report names the totals, the time, and the top barrels with their importer counts; `debug` narrates each rewrite | Unit | pass | not run | not run | not run |
| vite build > the default report shows the eight biggest barrels and counts the rest; `report: "all"` lists every one | Unit | pass | not run | not run | not run |
| vite build > without the plugin the barrel and every leaf are in the graph (the baseline the pass beats) | Unit | pass | not run | not run | not run |
| vite dev > a leaf the client and the server resolve to different files (#252) > client and SSR transforms at the same time: each gets its own leaf#252 | Unit | pass | not run | not run | not run |
| vite dev > a leaf the client and the server resolve to different files (#252) > the client first, then SSR (and the other way): the cached barrel map is not handed across#252 | Unit | pass | not run | not run | not run |
| vite dev > editing a barrel re-points the importer on the next transform (watch + invalidate) | Unit | pass | not run | not run | not run |
| vite dev > transformRequest returns leaf imports for a TS module and a Svelte component | Unit | pass | not run | not run | not run |
| which ids are importers > a build with extracted component CSS warns about nothing and still rewrites the component | Unit | pass | not run | not run | not run |
| which ids are importers > the script only: a style sub-module or a raw/url/worker request is not the component | Unit | pass | not run | not run | not run |
packages/barrels/test/rewrite.test.ts | |||||
| rewrite — output shapes > `import { default as X }` is a named default; two aliases of one leaf default get two lines | Unit | pass | not run | not run | not run |
| rewrite — output shapes > a barrel imported through two different specifiers (alias and relative) is the same barrel | Unit | pass | not run | not run | not run |
| rewrite — output shapes > a default import of the barrel is rewritten only when the barrel re-exports its default | Unit | pass | not run | not run | not run |
| rewrite — output shapes > a forced impure barrel whose names all moved keeps a bare import so its own code still runs | Unit | pass | not run | not run | not run |
| rewrite — output shapes > a leaf path with a quote in it is escaped in the emitted import | Unit | pass | not run | not run | not run |
| rewrite — output shapes > a namespace re-export becomes `import * as` | Unit | pass | not run | not run | not run |
| rewrite — output shapes > an importer that is itself a barrel gets rewritten too (a barrel of barrels flattens one level per file) | Unit | pass | not run | not run | not run |
| rewrite — output shapes > cursed spellings: no semicolons, no spaces, comments and newlines inside the braces, unicode, string export names on both sides | Unit | pass | not run | not run | not run |
| rewrite — output shapes > emits a high-resolution sourcemap that still maps the untouched tail of the file | Unit | pass | not run | not run | not run |
| rewrite — output shapes > import attributes ride onto every leaf import | Unit | pass | not run | not run | not run |
| rewrite — output shapes > named imports go to their leaves, one import per leaf, local names unchanged; the barrel import disappears | Unit | pass | not run | not run | not run |
| rewrite — output shapes > returns null (no work) for a file that imports no barrel, and for a syntax error | Unit | pass | not run | not run | not run |
| rewrite — output shapes > the skip policy leaves an import with a listed attribute key untouched — the ogygia mark stays on the barrel | Unit | pass | not run | not run | not run |
| rewrite — output shapes > two imports of the same barrel in one file are both rewritten; other imports are left byte-identical | Unit | pass | not run | not run | not run |
| rewrite — output shapes > type-only: an `import type {}` declaration is left alone (erased, no edge); a mixed import splits, and a leaf that only gets `type` specifiers is imported `type` | Unit | pass | not run | not run | not run |
| rewrite — output shapes > untouched by design: `import * as B`, `import "barrel"`, dynamic import; a default the barrel OWNS stays | Unit | pass | not run | not run | not run |
| rewrite — output shapes > what cannot move stays on the barrel: unknown names, own names of a forced barrel, ambiguous names | Unit | pass | not run | not run | not run |
packages/barrels/test/svelte.test.ts | |||||
| rewrite_svelte > `lang="ts"` types in the script do not break the parse (satisfies, generics, `as const`) | Unit | pass | not run | not run | not run |
| rewrite_svelte > a `.svelte.ts` module goes through the plain rewriter | Unit | pass | not run | not run | not run |
| rewrite_svelte > a <style lang="scss"> the CSS parser rejects no longer skips the file; the style stays byte-identical | Unit | pass | not run | not run | not run |
| rewrite_svelte > a barrel that re-exports a Svelte component through a nested barrel still lands on the .svelte file | Unit | pass | not run | not run | not run |
| rewrite_svelte > a component that still cannot be parsed is reported (code and position), never skipped in silence | Unit | pass | not run | not run | not run |
| rewrite_svelte > a region-marked import in a component is left alone under the skip policy; the unmarked one next to it moves | Unit | pass | not run | not run | not run |
| rewrite_svelte > a script AFTER the style block is rewritten at the right place (the blanking keeps every offset) | Unit | pass | not run | not run | not run |
| rewrite_svelte > import-looking text in a template string, a comment, and the markup is never rewritten | Unit | pass | not run | not run | not run |
| rewrite_svelte > no script, a component that imports no barrel, and a syntax error all leave the file alone | Unit | pass | not run | not run | not run |
| rewrite_svelte > rewrites the instance script and leaves the markup byte-identical | Unit | pass | not run | not run | not run |
| rewrite_svelte > rewrites the module script too, and both when present; attributes ride along | Unit | pass | not run | not run | not run |