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

ngx-testbedder

v1.0.0-beta.5

Published

`ngx-testbedder` helps you to write the TestBed for an Angular (2.0+) application.

Downloads

5

Readme

ngx-testbedder

ngx-testbedder helps you to write the TestBed for an Angular (2.0+) application.

It displays a tree based on dependencies of a given file to this command. In addition, as you write integration tests in an Angular applications you can select the real modules and mock modules to use for testing. Then, the import statement necessary for that purpose and providers for a test bed are generated and output on the screen.

Demo

demo

? Which module do you use as real? (Press <space> to select, <a> to toggle all, <i> to inverse selection)
❯◯ Done
 ◉ DetailComponent
 ◯ ├── AppActionsService
 ◯ ├── AppDispatcherService
 ◯ ├── AppStoreService
 ◯ ├── ProjectsActionsService
 ◯ └── ProjectsStoreService

The prompt displays a checkable dependency tree.

  • Checked
    • We will use the real module in the test.
  • Unchecked
    • We will replace it with a mock module in the test.

If you press the Enter key without checking Done, the tree will be updated with other modules that the real module depends on.

To complete, check Done and press the Enter key. Then, the result will be output.

Installation

You can install ngx-testbedder command using npm.

$ npm install --global ngx-testbedder

# or to local

$ npm install --save-dev ngx-testbedder

Requirements:

  • Node.js 6.9.0+
  • npm 3.0.0+

Usage

$ testbedder ./src/app/app.component.ts

# or if you installed to local

$ $(npm bin)/testbedder ./src/app/app.component.ts

API

testbedder

$ testbedder [TypeScript file path] [Options]

Options

--tsconfig

Alias: -c

  • You can specify a file path of tsconfig.json.
  • As default, it will look for ./tsconfig.json. If not found, search inside ./src/tsconfig.json.

--verbose

Alias: -v

  • It prints debug log verbose.
  • Default is false

--tree

Alias: -t

  • It displays only a tree.
  • The prompt is not displayed.
  • Default is false

--pattern

Alias: --pt

  • You can specify a pattern to name mock file.
    • angular-cli recommends foo-bar.spec.ts as name the spec file.
    • Similarly, we propose the name foo-bar.mock.ts to the mock file.
    • Please change this naming convention within the scope of the regular expression if you want.
  • Default is (.*)\.ts

--replacement

Alias: --rp

  • You can specify the replacement result for the above --pattern.
  • Default is $1.mock.ts

--help

  • It shows help.

--version

  • It shows the version.

Contributions

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT © OKUNOKENTARO