定制 tito10047/asset-mapper-test-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tito10047/asset-mapper-test-bundle

最新稳定版本:0.2.0

Composer 安装命令:

composer require tito10047/asset-mapper-test-bundle

包简介

A Symfony bundle that bridges the gap between Symfony AssetMapper and Node.js test runners by creating a symlink-based node_modules structure from your import map.

README 文档

README

CI License

Run Node.js tests against packages managed by Symfony AssetMapper — no npm install, no duplicated dependencies.

Two interchangeable strategies are provided:

Strategy Command How it works
Symlinks (default) php bin/console asset-mapper-test:setup Creates symlinks in node_modules/ from importmap.php
Symlink-free loader php bin/console asset-mapper-test:export Exports importmap.json, a Node.js loader maps imports live

Pick symlinks for best IDE autocomplete. Pick the loader when you want zero node_modules, cross-platform cleanliness (Windows without developer mode), or reproducible CI without filesystem artifacts.

Install

composer require --dev tito10047/asset-mapper-test-bundle

Auto-discovered by Symfony Flex — no additional wiring needed.

Scaffold package.json (interactive)

php bin/console asset-mapper-test:init

Asks which variant (symlink / loader) and which JS runner (node / vitest) you want, then writes a matching package.json. For node --test it also drops tests/js/setup.mjs with a ready-to-use happy-dom window bootstrap (globalThis.window, document, HTMLElement, Event).

Non-interactive (CI) form:

php bin/console asset-mapper-test:init --variant=loader --runner=node

Quick start — Symlink variant

{
  "type": "module",
  "scripts": {
    "pretest": "php bin/console asset-mapper-test:setup",
    "test":    "node --import ./tests/js/setup.mjs --test 'tests/js/**/*.test.mjs'"
  }
}
npm test

Quick start — Loader variant (no node_modules)

{
  "type": "module",
  "scripts": {
    "pretest": "php bin/console asset-mapper-test:export",
    "test":    "node --import ./vendor/tito10047/asset-mapper-test-bundle/src/Resources/loader/register.mjs --import ./tests/js/setup.mjs --test 'tests/js/**/*.test.mjs'"
  }
}

Requires Node.js ≥ 20.6 (or ≥ 18.19) for the stable module.register API.

Documentation

Full documentation lives in docs/:

Requirements

  • PHP ≥ 8.2
  • Symfony ≥ 6.4 (also works on 7.x and 8.x)
  • Symfony AssetMapper
  • Node.js ≥ 20.6 for the loader variant (any version for symlinks)

License

MIT — see LICENSE.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固