Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add several tests to templates #109

Merged
merged 25 commits into from
Jun 24, 2024
Merged

Add several tests to templates #109

merged 25 commits into from
Jun 24, 2024

Conversation

cezaraugusto
Copy link
Member

@cezaraugusto cezaraugusto commented Jun 20, 2024

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 cezaraugusto self-assigned this Jun 23, 2024
@cezaraugusto cezaraugusto requested a review from OSpoon June 23, 2024 22:04
@cezaraugusto cezaraugusto marked this pull request as ready for review June 23, 2024 22:31
Copy link
Member

Choose a reason for hiding this comment

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

The statement that imports semver can be deleted.

Copy link
Member Author

Choose a reason for hiding this comment

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

got it, deleted

Copy link
Member

Choose a reason for hiding this comment

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

This code refactoring is very good.

Copy link
Member

@OSpoon OSpoon left a comment

Choose a reason for hiding this comment

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

I have confirmed these unit tests and found no issues other than they run slowly.

Do you have any thoughts on ensuring the extension operates correctly in a browser environment? Should we consider incorporating end-to-end testing for this purpose?

@cezaraugusto
Copy link
Member Author

@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

Copy link
Member

@OSpoon OSpoon left a comment

Choose a reason for hiding this comment

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

LGTM++

@cezaraugusto cezaraugusto merged commit 07032d7 into main Jun 24, 2024
6 checks passed
@cezaraugusto cezaraugusto deleted the template-tests branch June 24, 2024 14:09
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.

2 participants