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

laxar-mocks

v2.0.0

Published

Building large applications is hard, so don't do that!

Downloads

149

Readme

LaxarJS Mocks Build Status

The companion testing framework for LaxarJS widgets.

What is LaxarJS Mocks?

LaxarJS Mocks simplifies writing tests for LaxarJS widgets, and helps running them.

It is a library that allows you to instantiate a testing sandbox for widgets, and that helps you to mock the services and the lifecycle events that LaxarJS provides. Use LaxarJS Mocks on top of Jasmine to setup and load a widget just like in an actual application. The available APIs then support you in instrumenting and inspecting the widget under test.

Although most widgets only have little direct dependency on LaxarJS (often they use only its event bus) and should mostly follow the best practices for their rendering technology such as AngularJS, React or Vue.js, they rely on a specific setup process provided by the LaxarJS runtime and tools.

This setup process includes

  • acquiring relevant assets (such as templates and stylesheets),
  • providing configuration and services (such as the event bus),
  • creation of the controller and rendering at the right time,
  • publishing the initial lifecycle events.

LaxarJS Mocks provides a programmatic interface to control this process and to load a widget within a test. It comes with the laxar-mocks/spec-loader for webpack, which makes sure that all controls and assets required for a widget test are collected, and that the appropriate adapter is loaded.

For an introduction to LaxarJS Mocks and details on test runner setup, have a look at the manuals. Additionally the API docs provide detailed information on the configuration, instrumentation and inspection options.

Getting Started

Usually, LaxarJS projects are started from the Yeoman Generator for LaxarJS 2.x, which automatically sets up LaxarJS Mocks for you, along with webpack and karma. If you need to perform a manual setup, for example as part of upgrading a LaxarJS 1.x project, there is an additional setup manual.

Hacking the Library

Instead of using a pre-compiled library within a project, you can also clone this repository:

git clone https://github.com/LaxarJS/laxar-mocks.git
cd laxar-mocks
npm install

To see changes in your application, either configure your project to work with the sources (e.g. by using webpack), or rebuild the webpack bundles by running npm run dist.

To run the automated karma tests:

npm test

To generate HTML spec runners for opening in your web browser, so that you can e.g. use the browser's developer tools:

npm start

Now you open the spec-runner by browsing to http://localhost:8081/dist/spec/laxar-mocks.spec.html.