generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Mearman/develop
add initial unit tests
- Loading branch information
Showing
9 changed files
with
7,282 additions
and
9,832 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
# name: Node.js CI | ||
# https://medium.com/swlh/jest-and-github-actions-eaf3eaf2427d | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [ master, main, develop ] | ||
pull_request: | ||
branches: [ master, main, develop ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
node-version: [ 14.x, 16.x, 18.x, 19.x ] | ||
max-parallel: 24 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci || npm install | ||
# before the first 'run' each "run" is a script from your project: | ||
# - run: npm run prettier | ||
# - run: npm run linter | ||
- run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,7 @@ data.json | |
|
||
# Exclude macOS Finder (System Explorer) View States | ||
.DS_Store | ||
|
||
coverage/ | ||
|
||
test-report.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="All Tests" type="JavaScriptTestRunnerJest" nameIsGenerated="true"> | ||
<node-interpreter value="project" /> | ||
<node-options value="" /> | ||
<jest-package value="$PROJECT_DIR$/node_modules/jest" /> | ||
<working-dir value="$PROJECT_DIR$" /> | ||
<envs /> | ||
<scope-kind value="ALL" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
// The test environment that Jest will use | ||
testEnvironment: "node", | ||
|
||
// The root directory for Jest tests | ||
roots: ["<rootDir>/src"], | ||
|
||
// The file extensions Jest will look for | ||
moduleFileExtensions: ["ts", "js"], | ||
|
||
// The test regex pattern to match test files | ||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
|
||
// The module name mapper to resolve module paths | ||
moduleNameMapper: { | ||
"^obsidian$": "<rootDir>/src/__mocks__/obsidian.ts", | ||
}, | ||
|
||
// The transform config for TypeScript files | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest", | ||
}, | ||
|
||
// The coverage report config | ||
collectCoverage: true, | ||
coverageDirectory: "<rootDir>/coverage", | ||
}; |
Oops, something went wrong.