Git Product home page Git Product logo

mock-match-media's People

Contributors

ayc0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mock-match-media's Issues

Reset width

I'm using this library in a jest-based project. I assume the effects of setMedia persist between tests. If that's the case could you consider 1. an api to reset all properties to default. and 2. call this new api automatically for test environments that have an afterEach hook? (like how RTL does it with cleanup)

A sincere thank you

Hey @Ayc0 , I know this is not the best place to write this, but thank you for creating this library!

I've tested many different mocks and none was as straightforward as this one, and this solves all problems I'm having to unit test highly dynamic components in various screen sizes.

Again, thanks for all the effort you are putting into this library, you are awesome ❤️

Invalid/incomplete types declarations in package.json

I am using mock-match-media in a Typescript 5.x project and get the following error on type checking:

error TS7016: Could not find a declaration file for module 'mock-match-media'. 
  '.../node_modules/mock-match-media/dist/index.mjs' implicitly has an 'any' type.
  There are types at '.../node_modules/mock-match-media/dist/index.d.ts', but this result
  could not be resolved when respecting package.json "exports". The 'mock-match-media' library
  may need to update its package.json or typings.

My understanding is, that typescript is expecting type declarations in the exports section of package.json.
Patching it locally to the following fixes it for me:

    "exports": {
        ".": {
            "types": "./dist/index.d.ts",    // <--- Added this
            "require": "./dist/index.js",
            "import": "./dist/index.mjs",
            "browser": "./dist/index.mjs"
        }
        ...

Also: the types declaration in the root of the package.json points to "dist/index.d.js" instead of "dist/index.d.ts".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.