https://github.com/rixo/svelte-hmr-spec
Test suite for Svelte HMR
https://github.com/rixo/svelte-hmr-spec
Last synced: about 1 year ago
JSON representation
Test suite for Svelte HMR
- Host: GitHub
- URL: https://github.com/rixo/svelte-hmr-spec
- Owner: rixo
- Created: 2019-07-29T21:40:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T07:37:11.000Z (over 3 years ago)
- Last Synced: 2025-02-25T09:28:58.184Z (over 1 year ago)
- Language: JavaScript
- Size: 826 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Svelte HMR Spec
Test suite for Svelte 3 HMR.
The whole project is only the tests. And a cool cli to run them on various targets.
## Install
```bash
git clone git@github.com:rixo/svelte-hmr-spec.git
cd svelte-hmr-spec
npm install
npm install --global .
cd app
npm install
```
## Usage
See inline help for an up to date description of available cli options:
```bash
svhs --help
```
To run the tests on the default bundled app (which should be last versions of svelte-loader, svelte, everything...):
```bash
svhs --default
```
To run the tests on a custom target, use `svhs ./path-to-your-app` (defaults to cwd). Example:
```bash
git clone https://github.com/rixo/demo-svelte-nollup
cd demo-svelte-nollup
npm install
svhs --watch
```
### Test Apps
The tests expect a basic svelte + webpack (or rollup / nollup) application with HMR enabled. They also expect the app to contain a `src/App.svelte` file, and a `src/main.js` file that bootstraps this App component on the document's body.
This is actually the default structure of the [webpack template app][template-webpack] with some customization to allow for programmatic control of the webpack instance. In particular, the webpack dev server's config must be located in the `webpack.config.js` file (the `contentBase` option specifically).
Look at the provided [default app] for a precise reference of what is expected. My [HMR demo app] should also be kept in sync to be usable as a test target (so you can start from that if you want to create a custom test target app).
[default app]: https://github.com/rixo/svelte-hmr-spec/tree/master/app
[hmr demo app]: https://github.com/rixo/demo-svelte3-hmr
[template-webpack]: https://github.com/sveltejs/template-webpack