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

reflow-core

v3.0.0-gamma.55

Published

Reflow Core

Downloads

193

Readme

reflow|core

$ npm install --save reflow-core

Current Features:

Create Mocha flows for true Integration Testing.

  • Test Flows
  • Subflows
  • Forking Subflows
  • Conditional subflows
  • Analyze mode
  • Multi-Threaded runtime
  • Tags

Example

Basic Flow

reflow("Example Flow", function() {
  return [
    getSuite('Mocha suite 1'),
    getSuite('Mocha suite 2'),
  ]
})

Subflows

By dividing the large flows into sub-flows, which increases the modularity of the flows by decreasing the granularity, it becomes easier to understand large flows and makes it possible to reuse the sub-flows to build custom flows, this also helps in getting rid of the duplicate code which can be found in large flows, in the following examples the suites [1,2,3] can be inserted in any flow by just adding the flow "sub-flow".

Example

Basic Sub-Flow

 subflow('Sub-flow', function() {
  return {
    suites: [
      getSuite('Mocha suite 1'),
      getSuite('Mocha suite 2'),
      getSuite('Mocha suite 3'),
    ],
  };
});

Forking

This is used to run a flow in two alternative versions, the flow would run in two sequences which are similar with a difference in where the flow was forked, in the given examples the flow would run twice, first it will go through the suites [1,2,3,5] the second time would run [1,2,4,5]

Example

Basic Fork

  getSubflow('Mocha suite 1'),
  getSubflow('Mocha suite 2'),
  fork([
    getSubflow('Mocha suite 3'),
    getSubflow('Mocha suite 4'),
  ]),
  getSubflow('Mocha suite 5'),

Conditional

In huge sized flows there could be a sequence that is exclusive to a certain flow which won't be ran if others, so conditionals are used to run these sub-flows, in this example the sub-flows in the flow.js file would run twice in the following sequences [1,2,3,5] and [1,2,4] this is because the suite number 5 is conditional to suite 3, if suit 3 doesn't run then neither will suite 5.

Example

Basic Hook

// Mocha_suite_5.js
subflow('Mocha suite 5', function() {
  return {
    condition: branches =>
      branches
        .find(branch => branch.name === 'Mocha suite 3'),
    suites: [
      getSuite('Mocha Test 1'),
      getSuite('Mocha Test 2'),
      getSuite('Mocha Test 3'),
    ],
  };
});

// flow.js
getSubflow('Mocha suite 1'),
getSubflow('Mocha suite 2'),
fork([
  getSubflow('Mocha suite 3'),
  getSubflow('Mocha suite 4'),
]),
getSubflow('Mocha suite 5'),

Hooks

These are mainly used to set global variables and help in the transition between the sub-flows, they can also be used to initialize any variable before the whole test starts.

Example

Basic Hook

hook('variable', function() {
  return {
    before() {
      reflow.set('Variable 1', value);
    },
  };
});

Todo

  • Add setup and teardown keywords for global before and global after. Currently hooks are used for this.