Skip to content

Commit d5a8e05

Browse files
committed
fixed jest
1 parent 12f603b commit d5a8e05

19 files changed

Lines changed: 5919 additions & 3808 deletions

.deepsource.toml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
"rules": {
1818
"no-unused-vars": "error",
19-
"@typescript-eslint/no-unused-vars": "off"
19+
"@typescript-eslint/no-unused-vars": "off",
20+
"no-use-before-define": "warn"
2021
}
2122
}

.gitignore

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,245 @@ data.json
55
package-lock.json
66
.nyc_output
77
coverage
8+
.vscode
9+
.yarn
10+
11+
# Created by https://www.toptal.com/developers/gitignore/api/node,obsidian,windows,macos,linux,yarn
12+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,obsidian,windows,macos,linux,yarn
13+
14+
### Linux ###
15+
*~
16+
17+
# temporary files which can be created if a process still has a handle open of a deleted file
18+
.fuse_hidden*
19+
20+
# KDE directory preferences
21+
.directory
22+
23+
# Linux trash folder which might appear on any partition or disk
24+
.Trash-*
25+
26+
# .nfs files are created when an open file is removed but is still being accessed
27+
.nfs*
28+
29+
### macOS ###
30+
# General
31+
.DS_Store
32+
.AppleDouble
33+
.LSOverride
34+
35+
# Icon must end with two \r
36+
Icon
37+
38+
39+
# Thumbnails
40+
._*
41+
42+
# Files that might appear in the root of a volume
43+
.DocumentRevisions-V100
44+
.fseventsd
45+
.Spotlight-V100
46+
.TemporaryItems
47+
.Trashes
48+
.VolumeIcon.icns
49+
.com.apple.timemachine.donotpresent
50+
51+
# Directories potentially created on remote AFP share
52+
.AppleDB
53+
.AppleDesktop
54+
Network Trash Folder
55+
Temporary Items
56+
.apdisk
57+
58+
### macOS Patch ###
59+
# iCloud generated files
60+
*.icloud
61+
62+
### Node ###
63+
# Logs
64+
logs
65+
*.log
66+
npm-debug.log*
67+
yarn-debug.log*
68+
yarn-error.log*
69+
lerna-debug.log*
70+
.pnpm-debug.log*
71+
72+
# Diagnostic reports (https://nodejs.org/api/report.html)
73+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
74+
75+
# Runtime data
76+
pids
77+
*.pid
78+
*.seed
79+
*.pid.lock
80+
81+
# Directory for instrumented libs generated by jscoverage/JSCover
82+
lib-cov
83+
84+
# Coverage directory used by tools like istanbul
85+
coverage
86+
*.lcov
87+
88+
# nyc test coverage
89+
.nyc_output
90+
91+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
92+
.grunt
93+
94+
# Bower dependency directory (https://bower.io/)
95+
bower_components
96+
97+
# node-waf configuration
98+
.lock-wscript
99+
100+
# Compiled binary addons (https://nodejs.org/api/addons.html)
101+
build/Release
102+
103+
# Dependency directories
104+
node_modules/
105+
jspm_packages/
106+
107+
# Snowpack dependency directory (https://snowpack.dev/)
108+
web_modules/
109+
110+
# TypeScript cache
111+
*.tsbuildinfo
112+
113+
# Optional npm cache directory
114+
.npm
115+
116+
# Optional eslint cache
117+
.eslintcache
118+
119+
# Optional stylelint cache
120+
.stylelintcache
121+
122+
# Microbundle cache
123+
.rpt2_cache/
124+
.rts2_cache_cjs/
125+
.rts2_cache_es/
126+
.rts2_cache_umd/
127+
128+
# Optional REPL history
129+
.node_repl_history
130+
131+
# Output of 'npm pack'
132+
*.tgz
133+
134+
# Yarn Integrity file
135+
.yarn-integrity
136+
137+
# dotenv environment variable files
138+
.env
139+
.env.development.local
140+
.env.test.local
141+
.env.production.local
142+
.env.local
143+
144+
# parcel-bundler cache (https://parceljs.org/)
145+
.cache
146+
.parcel-cache
147+
148+
# Next.js build output
149+
.next
150+
out
151+
152+
# Nuxt.js build / generate output
153+
.nuxt
154+
dist
155+
156+
# Gatsby files
157+
.cache/
158+
# Comment in the public line in if your project uses Gatsby and not Next.js
159+
# https://nextjs.org/blog/next-9-1#public-directory-support
160+
# public
161+
162+
# vuepress build output
163+
.vuepress/dist
164+
165+
# vuepress v2.x temp and cache directory
166+
.temp
167+
168+
# Docusaurus cache and generated files
169+
.docusaurus
170+
171+
# Serverless directories
172+
.serverless/
173+
174+
# FuseBox cache
175+
.fusebox/
176+
177+
# DynamoDB Local files
178+
.dynamodb/
179+
180+
# TernJS port file
181+
.tern-port
182+
183+
# Stores VSCode versions used for testing VSCode extensions
184+
.vscode-test
185+
186+
# yarn v2
187+
.yarn/cache
188+
.yarn/unplugged
189+
.yarn/build-state.yml
190+
.yarn/install-state.gz
191+
.pnp.*
192+
193+
### Node Patch ###
194+
# Serverless Webpack directories
195+
.webpack/
196+
197+
# Optional stylelint cache
198+
199+
# SvelteKit build / generate output
200+
.svelte-kit
201+
202+
### Obsidian ###
203+
# config dir
204+
.obsidian/
205+
206+
### Windows ###
207+
# Windows thumbnail cache files
208+
Thumbs.db
209+
Thumbs.db:encryptable
210+
ehthumbs.db
211+
ehthumbs_vista.db
212+
213+
# Dump file
214+
*.stackdump
215+
216+
# Folder config file
217+
[Dd]esktop.ini
218+
219+
# Recycle Bin used on file shares
220+
$RECYCLE.BIN/
221+
222+
# Windows Installer files
223+
*.cab
224+
*.msi
225+
*.msix
226+
*.msm
227+
*.msp
228+
229+
# Windows shortcuts
230+
*.lnk
231+
232+
### yarn ###
233+
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
234+
235+
.yarn/*
236+
!.yarn/releases
237+
!.yarn/patches
238+
!.yarn/plugins
239+
!.yarn/sdks
240+
!.yarn/versions
241+
242+
# if you are NOT using Zero-installs, then:
243+
# comment the following lines
244+
!.yarn/cache
245+
246+
# and uncomment the following lines
247+
# .pnp.*
248+
249+
# End of https://www.toptal.com/developers/gitignore/api/node,obsidian,windows,macos,linux,yarn

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ _This file only contains basic instructions to get you to using this plugin quic
99
---
1010

1111
# 🔮 How to use
12+
1213
### With Command
14+
1315
Since version `1.1.0` you can create plots via a handy GUI with live-preview functionality.
16+
1417
1. Open the command palette and select `Obsidian Functionplot: Plot a Function`
1518

1619
2. Adjust the plot to your liking.
@@ -22,8 +25,9 @@ Since version `1.1.0` you can create plots via a handy GUI with live-preview fun
2225

2326
<!-- ![Graph image](./images/plot/light.png#gh-light-mode-only)
2427
![Graph image](./images/plot/dark.png#gh-dark-mode-only) -->
25-
28+
2629
### With `functionplot` Block
30+
2731
````
2832
```functionplot
2933
---
@@ -37,7 +41,9 @@ grid: boolean
3741
<name>(variable)=<expression>
3842
```
3943
````
44+
4045
Example:
46+
4147
````
4248
```functionplot
4349
---
@@ -54,25 +60,25 @@ f(x)=E+log(x)*2
5460
````
5561

5662
## 🧮 Supported Math
63+
5764
To see the complete list of supported math functions, please check the [wiki](https://github.com/leonhma/obsidian-functionplot/wiki).
58-
65+
5966
## ⚙ Plugin Settings
67+
6068
Since version `1.2.0` there's a dedicated settings page for this plugin. Here you can adjust things like font sizes for the text elements of the plot, line widths and various colors. To access this page, head to the obsidian settings and scroll down the list to 'Community Plugins > Obsidian Functionplot'.
6169

6270
![Settings Page](https://github.com/leonhma/obsidian-functionplot/blob/master/images/settings/dark.png)
63-
64-
> **Note**
65-
> For changes to be applied, Obsidian needs to "re-render" the chart. You can either restart Obsidian, or switch between view modes (eg. Reading mode > Edit mode > Reading mode).
66-
6771

72+
> **Note**
73+
> For changes to be applied, Obsidian needs to "re-render" the chart. You can either restart Obsidian, or switch between view modes (eg. Reading mode > Edit mode > Reading mode).
6874
6975
---
7076

7177
## ❓ Questions
7278

7379
If you have any questions about the usage of the plugin, take a look at the [wiki](https://github.com/leonhma/obsidian-functionplot/wiki) or post a question in the [discussions](https://github.com/leonhma/obsidian-functionplot/discussions).
7480

75-
## 🐞 Bugs and Errors
81+
## 🐞 Bugs and Errors
7682

7783
If you encounter any errors while using this plugin, please report them to us. To do so, click [this link](https://github.com/leonhma/obsidian-functionplot/issues/new?assignees=leonhma&labels=bug&template=BUG_REPORT.yml), fill out the form as best as you can and click `Submit new issue`. These issues are publically viewable, so please don't submit any personal information.
7884

jest.config.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type { JestConfigWithTsJest } from "ts-jest";
2-
3-
const jestConfig: JestConfigWithTsJest = {
4-
// [...]
5-
// Replace `ts-jest` with the preset you want to use
6-
// from the above list
7-
preset: "ts-jest/presets/js-with-babel-esm",
1+
export default {
2+
roots: ["<rootDir>/src"],
3+
testMatch: ["**/__tests__/**/*.+(ts)"],
4+
preset: "ts-jest/presets/js-with-ts",
5+
testEnvironment: "node",
6+
verbose: true,
7+
transformIgnorePatterns: ["<rootDir>/node_modules/"],
88
};
9-
10-
export default jestConfig;

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"private": true,
1010
"scripts": {
1111
"build": "webpack",
12-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12+
"test": "jest",
1313
"format": "yarn prettier --write .",
1414
"lint": "yarn eslint ."
1515
},
@@ -18,12 +18,9 @@
1818
"@types/node": "*",
1919
"@typescript-eslint/eslint-plugin": "^5.41.0",
2020
"@typescript-eslint/parser": "^5.41.0",
21-
"cjstoesm": "^2.1.2",
22-
"default-import": "^1.1.5",
2321
"eslint": "^8.26.0",
2422
"eslint-config-prettier": "^8.5.0",
2523
"jest": "^29.2.2",
26-
"jest-environment-node": "^29.2.2",
2724
"prettier": "^2.7.1",
2825
"sass": "^1.54.4",
2926
"sass-loader": "^13.0.2",
@@ -37,7 +34,6 @@
3734
},
3835
"dependencies": {
3936
"function-plot": "^1.22.9-0",
40-
"html-to-image": "^1.10.8",
4137
"obsidian": "0.12.2"
4238
}
4339
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parseCodeBlock } from "../src/common/utils";
1+
import { parseCodeBlock } from "../common/utils";
22

33
describe("parseCodeBlock", () => {
44
test("header is parsed correctly", () => {

0 commit comments

Comments
 (0)