chaijs / chai-spies

Spies for Chai Assertion Library.
MIT License
132 stars 29 forks source link

export spy function as names export from chai-spies #106

Open Fuzzyma opened 5 years ago

Fuzzyma commented 5 years ago

Atm one as to register the spies before beeing able to use it with the chai-object chai.spy

However, I like to import only what I need:

import {expect, use} from 'chai'
import spies from 'chai-spies'

use(spies)

As you can see I cannot grab the spy function because its not available at import time. Thats why it would be cool to have a named export on chai-spies which returns a wrapper to the chai.spy. That way you can do:

import {expect, use} from 'chai'
import spies, {spy} from 'chai-spies'

use(spies)

What do you think?

nopeless commented 2 years ago

This issue is stale, but if you are using TypeScript you can define global variables

declare var Spy: import("chai").spy;