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

docs: add a guide to test changes locally #866

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

## How to Contribute
- **Types of Contributions**: There are different ways to contribute to the project. You can contribute by writing code, documentation, reporting bugs, requesting new features, or providing community support in our [Development support channel](https://teams.microsoft.com/l/channel/19%3a5e33f67fe502441f914fbcdc6e2548f5%40thread.skype/Development%2520support%2520-%2520Tegel?groupId=79f9bfeb-73e2-424d-9477-b236191ece5e&tenantId=3bc062e4-ac9d-4c17-b4dd-3aad637ff1ac) or use [GitHub Discussions](/~https://github.com/scania-digital-design-system/tegel/discussions) to start new topic.
- **First-Time Contributors**: We recommend taking a look on the reported [issues](/~https://github.com/scania-digital-design-system/tegel/issues) here on GitHub. We consider a small bug or improvement a best candidate for first contribution.
- **First-Time Contributors**: We recommend taking a look on the reported [issues](/~https://github.com/scania-digital-design-system/tegel/issues) here on GitHub. We consider a small bug or improvement a best candidate for first contribution.

## Before You Start
- **Type of Contribution**: If the contribution is a new component or a significant change to an existing one, please get in touch with Tegel's designers and developers beforehand to align on the direction.
Expand All @@ -23,6 +23,22 @@
## Style Guides
- **Code Style**: Please read our [Code Style](/~https://github.com/scania-digital-design-system/tegel/blob/main/CODE_STYLE.md) before contributing.

## Testing your changes locally
To properly test your changes' behaviors in a project, reference your local Tegel instance instead of the published version on the registry
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
To properly test your changes' behaviors in a project, reference your local Tegel instance instead of the published version on the registry
To properly test your changes in a project, reference your local Tegel instance instead of the published version on the registry

- **Build Tegel**: Navigate to your current Tegel monorepo directory, and run `npm run build-all`. This will build core Tegel as well as all packages currently supported (Angular, Angular 17 & React).
- **Linking**: Now building is done, navigate to `packages/core` within Tegel's repository and run `npm link`.
- **Using linked instance**: We're ready to work now, navigate to your project and run `npm link '@scania/tegel'`. This will create a symlink to the local package, but it won't add Tegel to your dependencies, if it wasn't already. Be sure to install it as dependency before linking, if required.

### (Optional) Testing Packages
In case you need to test React or Angular packages of Tegel, follow the instructions below replacing `{package}` for **react**, **angular** or **angular-17** respectively.
- **Building**: Complete the build step for Tegel and verify that the package you plan to test has been built successfully. There are commands available to only build specific packages, i.e., `npm run build-{package}`.
- **Linking**: After linking core, navigate to `packages/{package}` and execute `npm run link`.
- **Using linked instances**: In your project run `npm link '@scania/tegel-{package}'` before running `npm link '@scania/tegel'`.

### Unlinking
- **Removing from Project**: In the project you want the link to be removed execute `npm unlink '@scania/tegel'`. In case any dependency issue arises, delete the `node_modules` folder and run `npm i` to start fresh.
- **Removing link from npm**: The reference for your local instance is stored globally, to remove it execute `npm uninstall --global '@scania/tegel'`.

## Testing
- **Running Tests**: Run `npm run test` to run the test suite. It will execute numerous Playwright tests and might take 15-20 seconds to complete all the tests. Tests run on commit at the moment. A successful test will enable committing.
- **Writing Tests**: In case a component has been changed or a new feature added, please update or write tests for it. We use [Playwright](https://playwright.dev/docs/writing-tests) for writing tests. Also, take a look at existing tests in our components and see how they are written.
Expand Down
Loading