chore(deps-dev): bump flatted from 3.3.3 to 3.4.2 (#67)
Bumps flatted from 3.3.3 to 3.4.2.
updated-dependencies:
- dependency-name: flatted dependency-version: 3.4.2 dependency-type: indirect …
Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Cordova Plugin Test Framework
The
cordova-plugin-test-frameworkplugin allows plugin authors to add tests (manual and automated) to their plugins. To achieve this itTests run directly inside existing Cordova projects, so you can rapidly switch between testing and development. You can also be sure that your test suite is testing the exact versions of plugins and platforms that your app is using.
TLDR; Try it
Use your existing Cordova app, or create a new one.
Plugins bundle their tests using a nested plugin in a
/testsdirectory. Here are a few examples how install both:To install the plugin from
masteron GitHub instead of npm, replace e.g.cordova-plugin-devicewithhttps://github.com/apache/cordova-plugin-device.gitFollow the docs for Setting up the test harness.
Writing Plugin Tests
Where do tests live?
Add a directory named
teststo the root of your plugin. Within this directory, create a nestedplugin.xmlfor the tests plugin. It should have a plugin id with the formpluginid-tests(e.g. thecordova-plugin-deviceplugin has the nested idcordova-plugin-device-tests) and should contain a<js-module>namedtests. E.g:For example, the
cordova-plugin-deviceplugin has this nestedplugin.xml.Create a
package.jsoninside your project’stests/folder. Plugins require apackage.jsonnow and tests are considered their own plugins. The latest version of the tools ensure to runnpm installon any plugin added to a project and pull in any dependencies. Therefore, plugin authors can now put npm dependencies around their tests into thepackage.jsonfile.For example, the
cordova-plugin-deviceplugin contains apackage.json.The
cordova-plugin-test-frameworkplugin will automatically find alltestsmodules across all plugins for which the nested tests plugin is installed.Defining Auto Tests
Export a function named
defineAutoTests, which defines your auto-tests when run. Use thejasmine-2.9format. E.g.:Note: Your tests will automatically be labeled with your plugin id, so do not prefix your test descriptions.
Defining Manual Tests
Export a function named
defineManualTests, which defines your manual-tests when run. Manual tests do not any test runner, and success/failure results are not officially reported in any standard way. Instead, create buttons to run arbitrary javascript when clicked, and display output to user usingconsoleor by manipulating a provided DOM element. E.g.:Make sure to document the expected outcome.
Note: Your tests will automatically be labeled with your plugin id, so do not prefix your test descriptions.
Example
See:
cordova-plugin-devicetests.Running Plugin Tests
Use your existing Cordova app, or create a new one.
Add this plugin:
Change the start page in
config.xmlwith<content src="cdvtests/index.html" />or add a link tocdvtests/index.htmlfrom within your app.Thats it!
FAQ
Q: Should I add
cordova-plugin-test-frameworkas a<dependency>of my plugin?Q: What do I do if my plugin tests must have very large assets?
Q: Should I ship my app with the test framework plugin installed?
cdvtests/index.html) from a help section of your app, to give end users a way to run your test suite out in the feild. That may help diagnose causes of issues within your app. Maybe.