Skip to content

test(package): add npm pack install fixtures#112

Open
paulfalgout wants to merge 1 commit into
masterfrom
test/v5-npm-pack-fixtures
Open

test(package): add npm pack install fixtures#112
paulfalgout wants to merge 1 commit into
masterfrom
test/v5-npm-pack-fixtures

Conversation

@paulfalgout
Copy link
Copy Markdown
Member

@paulfalgout paulfalgout commented Jun 5, 2026

Closes #67

Summary

  • Add isolated npm pack fixture projects for CJS, ESM, unsupported default import, Backbone shim, jQuery DomApi, Vite, and the minimum underscore peer.
  • Add npm run test:fixtures to build, pack, install the tarball into each fixture, run each fixture validator, and clean generated fixture state.
  • Run the package fixture command in CI after coverage.

Public Behavior Boundary

  • This PR validates published package behavior only. It does not change runtime source behavior or package exports.
  • The default namespace import remains unsupported in v5.
  • Backbone behavior is only patched through explicit marionette/backbone import.
  • jQuery is only used by explicit marionette/jquery-dom-api import. The fixture validates the shipped adapter behavior: view.$() returns a jQuery collection while $el remains absent because the adapter does not provide wrapEl.

Fixture List

  • test/fixtures/cjs-node: require("marionette") exposes View and MnObject.
  • test/fixtures/esm-node: import * as Mn from "marionette" exposes View and MnObject, with no default export.
  • test/fixtures/no-default-export: default import fails in a controlled subprocess.
  • test/fixtures/shim: explicit marionette/backbone import patches Backbone.
  • test/fixtures/jquery-dom-api: jQuery DomApi works when jQuery is installed locally.
  • test/fixtures/vite: vite build succeeds against the packed package.
  • test/fixtures/peer-underscore-min: ESM import works with underscore@1.13.0.

Package/Export Behavior Verified

  • Fixtures install the produced .tgz with npm install --no-save, not source aliases.
  • Core fixtures install underscore only; they do not install Backbone or jQuery.
  • The Backbone shim fixture installs Backbone locally.
  • The jQuery DomApi fixture installs jQuery locally.

Validation Commands and Results

  • npm run lint:ci passed.
  • npm run build passed. Existing Browserslist freshness and Rollup circular dependency warnings were emitted.
  • npm pack passed and listed the expected dist/package files.
  • npm run test:fixtures passed for all seven fixtures. Existing Browserslist/Rollup warnings were emitted during the internal build; npm also emitted a transitive whatwg-encoding deprecation warning from the jsdom fixture install.
  • ruby -e "require 'yaml'; YAML.load_file('.github/workflows/ci.yml'); puts 'workflow yaml ok'" passed.

CI Integration Notes

  • CI now runs npm run test:fixtures after coverage on Node 24.
  • The workflow does not publish packages.

Scope Creep Check

  • No runtime source changes.
  • No package export changes.
  • No test runner migration changes.
  • No files under logs/ modified.

Follow-up Issues

  • Browser-specific install fixture coverage can be added later if the project decides to test browser variants beyond the current Vite package build check.

Summary by cubic

Adds npm pack install fixtures and a npm run test:fixtures workflow to validate the published marionette package across key usage scenarios. CI now runs these checks after coverage to catch packaging/export issues.

  • New Features
    • Added seven fixtures: CJS (require), ESM (import * as), no default import, marionette/backbone shim, marionette/jquery-dom-api adapter with jquery, vite build, and minimum underscore@1.13.0.
    • Added test:fixtures script to build, pack, install the tarball into each fixture, run validators, and clean state.
    • CI runs npm run test:fixtures on Node 24 after coverage.
    • Verifies no default export, Backbone patch only via marionette/backbone, jQuery usage only via marionette/jquery-dom-api, and that core requires only underscore.
    • No runtime source or package export changes.

Written for commit f462a94. Summary will update on new commits.

Review in cubic

Copilot AI review requested due to automatic review settings June 5, 2026 16:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Warning

Review limit reached

@paulfalgout, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 25 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 558d2220-f49f-4131-9aba-093bd03e4e85

📥 Commits

Reviewing files that changed from the base of the PR and between d3fcb82 and f462a94.

📒 Files selected for processing (18)
  • .github/workflows/ci.yml
  • package.json
  • test/fixtures/cjs-node/package.json
  • test/fixtures/cjs-node/validate.cjs
  • test/fixtures/esm-node/package.json
  • test/fixtures/esm-node/validate.mjs
  • test/fixtures/jquery-dom-api/package.json
  • test/fixtures/jquery-dom-api/validate.mjs
  • test/fixtures/no-default-export/package.json
  • test/fixtures/no-default-export/validate.mjs
  • test/fixtures/peer-underscore-min/package.json
  • test/fixtures/peer-underscore-min/validate.mjs
  • test/fixtures/run.mjs
  • test/fixtures/shim/package.json
  • test/fixtures/shim/validate.mjs
  • test/fixtures/vite/index.html
  • test/fixtures/vite/package.json
  • test/fixtures/vite/src/main.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/v5-npm-pack-fixtures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a set of isolated “install-from-npm pack tarball” fixtures plus a runner/CI step to validate the published package shape (entrypoints/exports/peers/optional adapters) without changing runtime behavior—aligned with Issue #67’s goal of catching packaging regressions that unit tests can’t.

Changes:

  • Added seven fixture projects under test/fixtures/* to validate CJS/ESM entrypoints, “no default export”, Backbone shim import, optional jQuery DomApi usage, Vite build, and minimum underscore peer.
  • Added test/fixtures/run.mjs and npm run test:fixtures to build, pack to a temp dir, install the tarball into each fixture, run validation, and clean generated state.
  • Wired the fixture run into CI after coverage on Node 24.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/fixtures/run.mjs Orchestrates build → pack → per-fixture install + validate + cleanup.
test/fixtures/cjs-node/package.json CJS fixture manifest + validate script.
test/fixtures/cjs-node/validate.cjs Asserts require('marionette') exposes View and MnObject.
test/fixtures/esm-node/package.json ESM fixture manifest + validate script.
test/fixtures/esm-node/validate.mjs Asserts import * as Mn exposes View/MnObject and no default.
test/fixtures/no-default-export/package.json “No default export” fixture manifest + validate script.
test/fixtures/no-default-export/validate.mjs Asserts default import fails in a controlled subprocess.
test/fixtures/shim/package.json Backbone shim fixture manifest + validate script.
test/fixtures/shim/validate.mjs Verifies marionette/backbone patches Backbone’s triggerMethod.
test/fixtures/jquery-dom-api/package.json jQuery DomApi fixture manifest + local jquery/jsdom deps.
test/fixtures/jquery-dom-api/validate.mjs Verifies jQuery DomApi makes view.$() return a jQuery collection.
test/fixtures/peer-underscore-min/package.json Pins underscore to 1.13.0 for minimum-peer validation.
test/fixtures/peer-underscore-min/validate.mjs Confirms underscore version and that ESM import exposes View.
test/fixtures/vite/package.json Vite build fixture manifest + vite build validator.
test/fixtures/vite/index.html Minimal Vite entry HTML for build validation.
test/fixtures/vite/src/main.js Imports from marionette to ensure Vite can bundle the packed package.
package.json Adds test:fixtures script and includes fixtures in base lint scope.
.github/workflows/ci.yml Runs npm run test:fixtures after coverage in CI.

Comment thread test/fixtures/run.mjs
Comment on lines +60 to +64
cleanFixture(fixtureDir);
run('npm', ['install'], { cwd: fixtureDir });
run('npm', ['install', '--no-save', tarballPath], { cwd: fixtureDir });
run('npm', ['run', 'validate'], { cwd: fixtureDir });
cleanFixture(fixtureDir);
Comment on lines +20 to +22
assert.ok(result instanceof $);
assert.strictEqual(result[0].textContent, 'child');
assert.strictEqual(Object.prototype.hasOwnProperty.call(view, '$el'), false);
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 18 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="package.json">

<violation number="1" location="package.json:65">
P2: `test/fixtures/` will not be linted for the new `.mjs` validator and runner files, so `lint:ci` misses the added fixture code.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread package.json
"coverage": "vitest run --coverage",
"coveralls": "npm run coverage && cat coverage/lcov.info | coveralls",
"lint:base": "eslint backbone.js config/ index.js jquery-dom-api.js mixins/ modules/ test/setup/vitest.js test/unit/ utils/ vitest.config.js",
"lint:base": "eslint backbone.js config/ index.js jquery-dom-api.js mixins/ modules/ test/fixtures/ test/setup/vitest.js test/unit/ utils/ vitest.config.js",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: test/fixtures/ will not be linted for the new .mjs validator and runner files, so lint:ci misses the added fixture code.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 65:

<comment>`test/fixtures/` will not be linted for the new `.mjs` validator and runner files, so `lint:ci` misses the added fixture code.</comment>

<file context>
@@ -62,10 +62,11 @@
     "coverage": "vitest run --coverage",
     "coveralls": "npm run coverage && cat coverage/lcov.info | coveralls",
-    "lint:base": "eslint backbone.js config/ index.js jquery-dom-api.js mixins/ modules/ test/setup/vitest.js test/unit/ utils/ vitest.config.js",
+    "lint:base": "eslint backbone.js config/ index.js jquery-dom-api.js mixins/ modules/ test/fixtures/ test/setup/vitest.js test/unit/ utils/ vitest.config.js",
     "lint": "npm run lint:base -- --fix",
     "lint:ci": "npm run lint:base -- --max-warnings=0",
</file context>

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

Successfully merging this pull request may close these issues.

v5: Add install-fixture tests against npm pack tarball

2 participants