Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-spies-decorators

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-spies-decorators

Chai Spies + ES7 decorators

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
2
Weekly downloads
 
Created
Source

chai-spies-decorators

npm install chai-spies-decorators

Provides ES7 decorators interface for chai-spies, allowing to set execution contracts on class methods in a nice declarative way. Requires Mocha.

import 'chai-spies-decorators'

describe ('example', () => {

	it ('works', () => {

		const foo = new (class Foo {

			@will.have.been.called.with (42).once
			bar () { }

			@will.have.been.called.twice
			zap () { }
		})

		foo.bar (42)
		foo.zap (); foo.zap ()
	})

})

How it works

I've written an article on Medium explaining it: Wiring ES7 decorators to Chai Spies for declarative contracts on class methods: A metaprogramming case study.

Warning

It is not very well tested with asynchronous tests. Should work with Promises, but not with done callback (not implemented).

Keywords

FAQs

Package last updated on 26 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc