-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(native): Plugin scaffold (#128)
- Loading branch information
Showing
21 changed files
with
4,373 additions
and
70 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
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
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
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
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
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
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
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,12 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/mocharc", | ||
"extension": ["ts", "tsx"], | ||
"recursive": true, | ||
"require": [ | ||
"ts-node/register", | ||
"react-native-testing-mocks/register", | ||
"test/setup.ts", | ||
"test/hooks.ts" | ||
], | ||
"spec": ["test/**/*.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/semantic-release", | ||
"branches": ["main"], | ||
"plugins": [ | ||
["@semantic-release/commit-analyzer", { | ||
"releaseRules": [ | ||
{ "scope": "!all", "release": false }, | ||
{ "scope": "!native", "release": false } | ||
] | ||
}], | ||
"@semantic-release/release-notes-generator", | ||
"semantic-release-yarn", | ||
"@semantic-release/github" | ||
], | ||
"tagFormat": "native/v${version}" | ||
} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Stack Builders Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,41 @@ | ||
# Assertive.ts Native | ||
|
||
An Assertive.ts plugin that provides assertion Matchers for React Native elements. | ||
|
||
## Requirements | ||
|
||
- **@assertive-ts/core:** >=2.0.0 | ||
|
||
## Install | ||
|
||
```sh | ||
npm install --save-dev @assertive-ts/native | ||
``` | ||
|
||
Or: | ||
|
||
```sh | ||
yarn add --dev @assertive-ts/native | ||
``` | ||
|
||
## API Reference | ||
|
||
You can find the full API reference [here](https://stackbuilders.github.io/assertive-ts/docs/native/build/) 📚 | ||
|
||
## Usage | ||
|
||
// TODO: Add usage documentation and examples... | ||
|
||
## License | ||
|
||
MIT, see [the LICENSE file](https://github.com/stackbuilders/assertive-ts/blob/main/packages/native/LICENSE). | ||
|
||
## Contributing | ||
|
||
Do you want to contribute to this project? Please take a look at our [contributing guidelines](https://github.com/stackbuilders/assertive-ts/blob/main/docs/CONTRIBUTING.md) to know how you can help us build it. | ||
|
||
--- | ||
|
||
<img src="https://www.stackbuilders.com/media/images/Sb-supports.original.png" alt="Stack Builders" width="50%" /> | ||
|
||
[Check out our libraries](https://github.com/stackbuilders/) | [Join our team](https://www.stackbuilders.com/join-us/) |
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,82 @@ | ||
{ | ||
"name": "@assertive-ts/native", | ||
"version": "0.0.0", | ||
"description": "Assertive.ts plugin for React Native assertions", | ||
"repository": "[email protected]:stackbuilders/assertive-ts.git", | ||
"homepage": "https://stackbuilders.github.io/assertive-ts/", | ||
"author": "Stack Builders <[email protected]>", | ||
"license": "MIT", | ||
"keywords": [ | ||
"assertions", | ||
"assertive-ts", | ||
"testing", | ||
"testing-tools", | ||
"type-safety", | ||
"typescript", | ||
"plugin", | ||
"react-native" | ||
], | ||
"main": "./dist/main.js", | ||
"types": "./dist/main.d.ts", | ||
"files": [ | ||
"dist/", | ||
"src/" | ||
], | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"scripts": { | ||
"build": "tsc -p tsconfig.prod.json", | ||
"check": "yarn compile && yarn test --forbid-only", | ||
"compile": "tsc -p tsconfig.json", | ||
"docs": "typedoc", | ||
"release": "semantic-release", | ||
"test": "NODE_ENV=test mocha" | ||
}, | ||
"dependencies": { | ||
"fast-deep-equal": "^3.1.3", | ||
"tslib": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@assertive-ts/core": "workspace:^", | ||
"@testing-library/react-native": "^12.4.4", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.11.19", | ||
"@types/react": "^18.2.70", | ||
"@types/react-test-renderer": "^18.0.7", | ||
"@types/sinon": "^17.0.3", | ||
"mocha": "^10.3.0", | ||
"react": "^18.2.0", | ||
"react-native": "^0.73.6", | ||
"react-native-testing-mocks": "^1.2.0", | ||
"react-test-renderer": "^18.2.0", | ||
"semantic-release": "^23.0.2", | ||
"semantic-release-yarn": "^3.0.2", | ||
"sinon": "^17.0.1", | ||
"ts-node": "^10.9.2", | ||
"typedoc": "^0.25.8", | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typedoc-plugin-merge-modules": "^5.1.0", | ||
"typescript": "^5.4.2" | ||
}, | ||
"peerDependencies": { | ||
"@assertive-ts/core": ">=2.0.0", | ||
"react": "*", | ||
"react-native": "*" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@assertive-ts/core": { | ||
"optional": false | ||
}, | ||
"react": { | ||
"optional": false | ||
}, | ||
"react-native": { | ||
"optional": false | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
} | ||
} |
Empty file.
Empty file.
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,16 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
import Sinon from "sinon"; | ||
|
||
export function mochaHooks(): Mocha.RootHookObject { | ||
return { | ||
afterEach() { | ||
Sinon.restore(); | ||
}, | ||
beforeEach() { | ||
Sinon.useFakeTimers({ | ||
advanceTimeDelta: 0, | ||
shouldAdvanceTime: true, | ||
}); | ||
}, | ||
}; | ||
} |
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 @@ | ||
import { userEvent } from "@testing-library/react-native"; | ||
import Sinon from "sinon"; | ||
|
||
process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS = "true"; | ||
|
||
const newUserEvent = userEvent.setup({ | ||
advanceTimers: delay => Sinon.clock.tickAsync(delay).then(), | ||
delay: 0, | ||
}); | ||
|
||
Object.assign(userEvent, newUserEvent); |
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,3 @@ | ||
describe("[Unit] main.test.ts", () => { | ||
// main tests here... | ||
}); |
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,18 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"jsx": "react-jsx", | ||
"outDir": "./build", | ||
"typeRoots": [ | ||
"../../node_modules/@types/", | ||
"./typings/" | ||
] | ||
}, | ||
"exclude": [ | ||
"build/*", | ||
"dist/*" | ||
], | ||
"ts-node": { | ||
"transpileOnly": true | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"incremental": false, | ||
"outDir": "./dist" | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
"typings/**/*" | ||
] | ||
} |
Oops, something went wrong.