diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f00ebc07b9..9c2cb51034 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -96,6 +96,17 @@ Test samples are kept in `/test/xxx/samples` folder.
1. To run test, run `npm run test`
1. To run test for a specific feature, you can use the `-g` (aka `--grep`) option. For example, to only run test involving transitions, run `npm run test -- -g transition`.
+##### Running solo test
+
+1. To run only one test, rename the test sample folder to end with `.solo`. For example, to run the `test/js/samples/action` only, rename it to `test/js/samples/action.solo`.
+1. To run only one test suite, rename the test suite folder to end with `.solo`. For example, to run the `test/js` test suite only, rename it to `test/js.solo`.
+1. Remember to rename the test folder back. The CI will fail if there's a solo test.
+
+##### Updating `.expected` files
+
+1. Tests suites like `css`, `js`, `server-side-rendering` asserts that the generated output has to match the content in the `.expected` file. For example, in the `js` test suites, the generated js code is compared against the content in `expected.js`.
+1. To update the content of the `.expected` file, run the test with `--update` flag. (`npm run test --update`)
+
#### Breaking changes
When adding a new breaking change, follow this template in your pull request:
diff --git a/site/content/examples/20-7guis/05-7guis-crud/App.svelte b/site/content/examples/20-7guis/05-7guis-crud/App.svelte
index f55aeb0d83..aec623d2a4 100644
--- a/site/content/examples/20-7guis/05-7guis-crud/App.svelte
+++ b/site/content/examples/20-7guis/05-7guis-crud/App.svelte
@@ -2,18 +2,9 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/test/preprocess/samples/comments/output.svelte b/test/preprocess/samples/comments/output.svelte
new file mode 100644
index 0000000000..2d3538af17
--- /dev/null
+++ b/test/preprocess/samples/comments/output.svelte
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.js
index 73b286044f..768917e833 100644
--- a/test/server-side-rendering/index.js
+++ b/test/server-side-rendering/index.js
@@ -6,7 +6,8 @@ import {
showOutput,
loadConfig,
setupHtmlEqual,
- tryToLoadJson
+ tryToLoadJson,
+ shouldUpdateExpected
} from "../helpers.js";
function tryToReadFile(file) {
@@ -58,18 +59,47 @@ describe("ssr", () => {
fs.writeFileSync(`${dir}/_actual.html`, html);
if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code);
- assert.htmlEqual(html, expectedHtml);
- assert.equal(
- css.code.replace(/^\s+/gm, ""),
- expectedCss.replace(/^\s+/gm, "")
- );
+ try {
+ assert.htmlEqual(html, expectedHtml);
+ } catch (error) {
+ if (shouldUpdateExpected()) {
+ fs.writeFileSync(`${dir}/_expected.html`, html);
+ console.log(`Updated ${dir}/_expected.html.`);
+ } else {
+ throw error;
+ }
+ }
+
+ try {
+ assert.equal(
+ css.code.replace(/^\s+/gm, ""),
+ expectedCss.replace(/^\s+/gm, "")
+ );
+ } catch (error) {
+ if (shouldUpdateExpected()) {
+ fs.writeFileSync(`${dir}/_expected.css`, css.code);
+ console.log(`Updated ${dir}/_expected.css.`);
+ } else {
+ throw error;
+ }
+ }
if (fs.existsSync(`${dir}/_expected-head.html`)) {
fs.writeFileSync(`${dir}/_actual-head.html`, head);
- assert.htmlEqual(
- head,
- fs.readFileSync(`${dir}/_expected-head.html`, 'utf-8')
- );
+
+ try {
+ assert.htmlEqual(
+ head,
+ fs.readFileSync(`${dir}/_expected-head.html`, 'utf-8')
+ );
+ } catch (error) {
+ if (shouldUpdateExpected()) {
+ fs.writeFileSync(`${dir}/_expected-head.html`, head);
+ console.log(`Updated ${dir}/_expected-head.html.`);
+ } else {
+ throw error;
+ }
+ }
}
if (show) showOutput(dir, { generate: 'ssr', format: 'cjs' });