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

tests-selector

v2.1.0

Published

Makes it easy to select tests for local test runs

Downloads

291

Readme

Tests Selector ·

CLI tool to select UI tests for execution.

tests-selector will parse your tests folder and provide a lost of features with tests inside. You can select any number of tests inside a feature.

npm downloads

Installation

$ npm install tests-selector --save-dev

Basic usage

Tests selector returns an array of selected tests paths. If you use framework like wdio or protractor that might not work for you. Tests selector also writes a file with the same array of selected tests, so you may read this file in your framework's config using getTestsFromFile method. Just run tests selector first. You may find examples in the repo.

specsSelector.js

const TestsSelector = require('tests-selector').;


if (require.main === module) {
  void async function () {
    const specsSelector = new TestsSelector({
      specsPath: `${process.cwd()}/test/specs`,
      specIdentifiers: ['spec', 'e2e'],
    });
    await specsSelector.selectTests();
  }();
}

package.json

"scripts": {
    "test": "node specsSelector.js && wdio run wdio.conf.js"
  },

wdio.conf

specs: specsSelector.getTestsFromFile(),

Features

  1. Supports any number of tests, just make subfolders.
  2. Remembers your choices. Just press enter a couple of times to run your previous tests.
  3. Filters your tests by preset identifier.
  4. Sets cursor to middle position for faster navigation.
  5. Press Esc ot Ctrl+C to go 1 directory back

Available options

| Option | Default | Description | | ------ | ------- | ----------- | | tempDataPath | <root>/.testsSelector | Directory to store temp files | | specsPath | <root>/specs | Path to your tests folder | | specIdentifiers | ['spec'] | Array of substrings to your test files. Tests selector will filter out all files in specsPath directory which don't have spec in their names | | maxFilesInDir | 10 | By default if a directory has more than 10 files Tests selector will suggest you to go inside of subdirectory so you won't have to go through 100 tests in console. Note that this wI'll work only if directory has only subdirectories without test files | | selectedTestsFileName | selectedTests.generated | File name where Tests selector writes tests paths you chose | | testChoiceNumberFileName | testChoiceNumber.indexHelper | File name where Tests selector writes your tests choices | | featureChoiceNumberFileName | featureChoiceNumber.indexHelper | File where Tests selector writes your feature choices |

TestsSelector instance also provide

Changelog

  • 1.0.0 - Initial release
  • 1.0.4 - Fix for absent dist
  • 1.0.9 - Added typings
  • 1.1.0 - Added getting selected tests from file method
  • 1.1.4 - optimized build
  • 1.1.5 - got rid of "default" when importing with JS
  • 1.1.6 - support for 0 nesting level tests
  • 1.1.7 - contributing guide
  • 2.0.0 - Go back feature

##Contributing

  • Create a personal fork of the project on Github.
  • Clone the fork on your local machine. Your remote repo on Github is called origin.
  • Add the original repository as a remote called upstream.
git remote add upstream https://github.com/Gennadiii/tests-selector
git remote -v
origin  https://github.com/username/tests-selector.git (fetch)
origin  https://github.com/username/tests-selector.git (push)
upstream        https://github.com/Gennadiii/tests-selector (fetch)
upstream        https://github.com/Gennadiii/tests-selector (push)
  • If you created your fork a while ago be sure to pull upstream changes into your local repository. git merge upstream/develop
  • Implement fix or feature.
  • Follow the code style of the project, including indentation.
  • Run tests from __spec__ folder (npm test).
  • Write or adopt tests as needed.
  • Make sure you didn't miss any tests (npm run test-coverage).
  • Add or change the documentation as needed.
  • Squash your commits.
  • Push your branch to your fork on Github, the remote origin.
  • From your fork open a pull request. Target the project's master.