solidjs/solid
test-integration
Active contributors: Ryan Carniato
A private workspace package that exists for one purpose: to import every published solid-js entry point from a fresh Node process and verify the export map is wired correctly. It is the safety net that catches regressions in packages/solid/package.json's exports block and in the Rollup config.
Purpose
solid-js ships seven entry points × multiple build flavors (browser, dev, server). It is uncomfortably easy for a refactor to break a path — for example, by removing a file from the files array, by mistyping an exports condition, or by forgetting to add a Rollup entry for a new sub-package. Behaviour tests inside packages/solid/test/ import from the in-source aliases (see packages/solid/vite.config.mjs), so they cannot catch these bundling issues.
test-integration runs Node directly against the built dist/ artifacts. If solid-js/web/dist/server.js is missing or no longer exports a needed name, this test fails the build before publish.
Directory layout
packages/test-integration/
├── package.json # private: true; depends on solid-js + babel-preset-solid (workspace:*)
├── babel.config.cjs # configures babel for the smoke harness
├── tsconfig.json
├── test-imports.mjs # the actual test
└── tests/ # vitest-based integration suite (test:integrations)Key abstractions
| Symbol | Source | Description |
|---|---|---|
checkError(error) |
packages/test-integration/test-imports.mjs |
Distinguishes "this should fail the test" errors (missing exports, missing files) from "expected" errors (e.g. importing solid-js/h standalone in Node, which fails because it depends on browser primitives). |
The bare Promise.all([...]) chain |
packages/test-integration/test-imports.mjs |
The list of every entry path that must be importable. |
How it works
Promise.all([
import('solid-js').catch(checkError),
import('solid-js/dist/solid.js').catch(checkError),
import('solid-js/web').catch(checkError),
import('solid-js/web/dist/web.js').catch(checkError),
import('solid-js/web/dist/server.js').catch(checkError),
import('solid-js/h').catch(checkError),
import('solid-js/h/dist/h.js').catch(checkError),
import('solid-js/html').catch(checkError),
import('solid-js/html/dist/html.js').catch(checkError),
])
.then(() => console.log('ES Module import test passed.'))
.catch((error) => {
console.error(error);
process.exit(1);
});checkError is the gatekeeper: it lets any error through unless the error code is ERR_PACKAGE_PATH_NOT_EXPORTED, ERR_MODULE_NOT_FOUND, or a SyntaxError complaining about a missing "type": "module". Those three are exactly the failure modes that mean the export map is broken; everything else (such as a runtime error inside solid-js/h because it expects DOM primitives) is silently allowed.
How it is run
pnpm --filter test-integration testWhich runs node test-imports.mjs. The package's test script wraps this; the test:integrations script runs the Vitest-based suite under tests/ for slightly heavier coverage.
The dependencies block declares babel-preset-solid: "workspace:*" and solid-js: "workspace:*", so the test always runs against the freshly built local versions, not against any cached npm copy.
Key source files
| File | Purpose |
|---|---|
packages/test-integration/test-imports.mjs |
The smoke test. Short, but it is the canary that catches packaging regressions. |
packages/test-integration/babel.config.cjs |
Babel config for the Vitest-based subsuite. |
packages/test-integration/package.json |
Private workspace package; declares the workspace deps. |
Integration points
- Depends on
solid-jsandbabel-preset-solidviaworkspace:*, so it always tests the in-repo build. - Runs after the rest of
pnpm testin the Turbo pipeline (turbo.json'stest-integration#testtaskdependsOn: ["solid-js#build", "solid-js#link"]). - Not published to npm (
"private": true).
Entry points for modification
- Adding a new entry point to
solid-js: add a corresponding line toPromise.all([...])intest-imports.mjs. If the new entry should not be importable from Node (e.g. browser-only DOM helper), still add it and rely oncheckErrorto ignore non-fatal failures — the goal is to verify the export resolves, not that it runs. - Tightening the smoke check: the
checkErrorallowlist is intentionally permissive. If you want a stricter check (e.g. assert a particular named export exists), add a follow-up.then(mod => assert("createSignal" in mod))to the relevantimport()line. - Speeding up CI: the package runs sequentially-ish because Node imports each entry. Most regressions land in the export map, so dropping more aggressive tests here is fine — the value is in the canary, not in coverage.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.