npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

meteor-desktop-test-suite

v0.2.2

Published

Few utils to ease out functional testing of Meteor Desktop modules/plugins.

Downloads

8

Readme

Meteor Desktop test suite

Few utils to ease out functional testing of Meteor Desktop modules/plugins. Take a look at the examples at the bottom of this readme to actually see how you can use this.

createTestApp(installPath, pluginName)

Creates a test app with plugin you are testing included. Plugin is installed by npm.

/**
 * @param {string} installPath - path at which to install the app
 * @param {string} pluginName  - name of the npm package (plugin) you are testing
 * @returns {Promise}
 */

constructPlugin(app, log, app, appSettings, eventsBus, modules, settings, Module)

It is instantiating your plugin. You can supply mocks for any params your plugin would normally receive from the skeleton app. Pass undefined if your plugin does not use certain param or if you want to use some defaults provided by this test suite. Check here to see what is passed by default.

fireEventsBusEvent(app, eventToFire, ...eventArgs)

Fires an event on the events bus, so you can simulate for example a system event on which you plugin is listening.

/**
 * @param {Object} app         - app ref from Spectron
 * @param {string} eventToFire - name of the event to fire
 * @param {...*}   eventArgs   - arguments to pass with the event
 * @returns {Promise}
 */

send(app, module, event, ...args)

Sends an IPC event to your module. Equivalent of Desktop.send.

/**
 * @param {Object} app    - app ref from Spectron
 * @param {string} module - module name your plugin is registering
 * @param {string} event  - event from your module
 * @param {...*}   args   - array of arguments to pass to ipc.send
 * @returns {Promise}
 */

fetch(app, module, event, ...args)

Fetches some data from main process by sending an IPC event and waiting for the response. Equivalent of Desktop.fetch. Promise will resolve to an array with payload that came with the response.

/**
 * @param {Object} app    - app ref from Spectron
 * @param {string} module - module name your plugin is registering
 * @param {string} event  - event from your module
 * @param {...*}   args   - array of arguments to pass to ipc.send
 * @return {Promise}
 */

fireEventsBusEventAndWaitForAnother(app, eventToFire, eventToListenFor, ...eventArgs)

Fires an event on the events bus and then waits for an another event to be emitted. Useful for example when your plugin is doing some stuff on afterLoading event and signalizes readiness via another event.

/**
 * @param {Object} app              - app ref from Spectron
 * @param {string} eventToFire      - name of the event to fire
 * @param {string} eventToListenFor - event to listen for on the events bus
 * @param {...*}   eventArgs        - arguments to pass with the event
 * @return {Promise}
 */

sendIpc(app, ...args)

Sends an IPC message to the main process.

/**
 * @param {Object} app - the app ref from Spectron
 * @param {...*}  args - array of arguments to pass to ipc.send
 * @returns {Promise}
 */

sendIpcSync(app, ...args)

Same as above but sync. However also returns a Promise as it is transferred through chromedriver.

sendIpcAndWaitForResponse(app, eventToSend, eventToListenFor, ...eventArgs)

Sends an IPC event and waits for an another IPC event to come.

/**
 * @param {Object} app              - app ref from Spectron
 * @param {string} eventToSend      - name of the ipc event to send
 * @param {string} eventToListenFor - ipc event to listen for
 * @param {...*}   eventArgs        - arguments to pass with the event
 * @returns {Promise}
 */

emitWindowCreated(app)

Makes the app emit windowCreated event.

/**
 * @param {Object} app - the app ref from Spectron
 * @returns {Promise}
 */

class Logger(show, showErrors)

Fake logger that eventually can write the logs to the console. You can set show to false and showErrors to true to only see errors passed to it.

Examples

An example of usage in tests is here meteor-desktop-splash-screen and here meteor-desktop-localstorage.

Changelog

  • 0.2.0 - plugins tests now save console output to log.txt