extension-js / extension.js

🧩 Plug-and-play, zero-config, cross-browser extension development tool.
https://extension.js.org
MIT License
3.67k stars 93 forks source link

Add several tests to templates #109

Closed cezaraugusto closed 3 months ago

cezaraugusto commented 3 months ago

Added a bunch of tests to cover CLI commands against the base templates.

Files changed ended up too big but mostly due to the fixtures I had to add to test the build command.

I also made a few changes to templates and tried to come up with a pattern for new additions. This is a starter to allow authors to add their own templates to our list.

# uiContext = 'sidebar' | 'newTab' | 'content' | 'popup' | 'devTools'

[template]/
├── images/
│   └── icons/
│       ├── icon_16.png
│       └── icon_48.png
├── [uiContext]/
│   ├── index.html        # (only for non content_scripts)
│   ├── styles.css
│   ├── scripts.js        # (or .jsx or .ts or .tsx)
│   └── [uiContextApp].ts # (or .jsx or .ts or .tsx – only for framework-based templates)
├── env.example           # (optional)
├── manifest.json
├── postcss.config.js     # (for tailwind templates)
├── README.md
├── tailwind.config.js    # (for tailwind templates)
└── .gitignore

Feedback welcome!

cezaraugusto commented 3 months ago

@OSpoon thanks for reviewing!

Regarding the e2e tests: yes, that would be ideal. This PR adds tests for create and build commands only, so having dev and start command tests against the default templates will help us a lot to prevent some bugs similar to those we are currently fixing