Skip to content

Commit

Permalink
docs: about test
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Mar 22, 2024
1 parent fc9e4d0 commit 7eecb0c
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 82 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"version": "0.0.2",
"scripts": {
"dev": "tiddlywiki-plugin-dev dev",
"dev:wiki": "tiddlywiki-plugin-dev dev --write-wiki",
"test": "tiddlywiki-plugin-dev test",
"build": "npm run clean && tiddlywiki-plugin-dev build",
"publish": "npm run clean && tiddlywiki-plugin-dev publish",
"reset": "rimraf ./**/node_modules",
Expand Down Expand Up @@ -46,6 +48,6 @@
"dependencies": {
"npm-check-updates": "^16.14.17",
"tiddlywiki": "^5.3.3",
"tiddlywiki-plugin-dev": "^0.0.41"
"tiddlywiki-plugin-dev": "^0.1.1"
}
}
98 changes: 21 additions & 77 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/doc/tutorials/en/007-commands.tid
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ npm run dev

After a short compilation, a web server will open and a browser will open it to see the effect. The page will be automatically recompiled and refreshed as the content of the plugin is modified.

This page is read-only, changes to it are not written back to the wiki folder, so feel free to modify it to debug.

!! Entering documentation writing mode

```bash
npm run dev:wiki
```

The page started is an editable page that allows you to edit the contents of the wiki folder directly.

!! Running tests

```bash
npm run test
```

See [[012-About debugging|$:/plugins/Modern.TiddlyDev/doc/tutorials/en/012-关于调试]] for details.

!! Building plugins

There are two forms.
Expand Down
17 changes: 15 additions & 2 deletions src/doc/tutorials/en/012-About debugging.tid
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ caption: About debugging
authors: whitefall
type: text/vnd.tiddlywiki

Q: How friendly is debugging? I generally prefer to play with the idea of finding the value, depending on the result, see what he is, in the next step, and then implement it step by step.
!! Q: How friendly is debugging? I generally prefer to play with the idea of finding the value, depending on the result, see what he is, in the next step, and then implement it step by step.


A: Use the console more often:
Expand All @@ -12,4 +12,17 @@ A: Use the console more often:
* But it should be noted that the environment you usually write widgets in is a sandbox not a browser environment (you can understand that some global variables you can't get, or some variables are only available inside), this should be noted.


A: Use debugger debugging statements.
A: Use debugger debugging statements.

!! Q: How do I write tests?

You can write tests in the `wiki/tiddlers/tests` folder, or you can write them in your plugin folder, as long as the meta file contains them:

```tid
type: application/javascript
tags: $:/tags/test-spec
```

The `$:/tags/test-spec` tag will mark this tiddler as a test and will be executed when you run `pnpm run test`.

Note that writing tests in the `wiki/tiddlers/tests` folder can only be done with JS; writing tests in plugins can be done with TS, but the tests will be packaged into the plugin, increasing its size.
18 changes: 18 additions & 0 deletions src/doc/tutorials/zh/007-commands.tid
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ npm run dev

经过短暂编译后,会打开一个网页服务器,浏览器打开之可以看到效果。页面会随着插件内容的修改自动重新编译、刷新。

这个页面是只读的,对它的修改不会写回到 wiki 文件夹,可以随意调试。

!! 进入文档编写模式

```bash
npm run dev:wiki
```

启动的页面是可编辑的页面,可以直接编辑 wiki 文件夹中的内容。

!! 运行自动化测试

```bash
npm run test
```

详见[[012-关于调试|$:/plugins/Modern.TiddlyDev/doc/tutorials/zh/012-关于调试]]。

!! 构建插件

有两种形式:
Expand Down
Loading

0 comments on commit 7eecb0c

Please # to comment.