sinonjs / fake-timers

Fake setTimeout and friends (collectively known as "timers"). Useful in your JavaScript tests. Extracted from Sinon.JS
BSD 3-Clause "New" or "Revised" License
794 stars 103 forks source link

missing dependency? #435

Closed xenoterracide closed 2 years ago

xenoterracide commented 2 years ago

seems all of my globalthis types, I think it's a missing dependency. I'm not actually using faketimers directly

../../node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:8:24 - error TS2304: Cannot find name 'setTimeout'.

8     setTimeout: typeof setTimeout;
                         ~~~~~~~~~~

We understand you have a problem and are in a hurry, but please provide us with some info to make it much more likely for your issue to be understood, worked on and resolved quickly.

@sinonjs/fake-timers@7.1.2
node_modules/@sinonjs/fake-timers
  @sinonjs/fake-timers@"^7.0.4" from nise@5.1.0
  node_modules/aws-sdk-mock/node_modules/nise
    nise@"^5.1.0" from sinon@11.1.2
    node_modules/aws-sdk-mock/node_modules/sinon
      sinon@"^11.1.1" from aws-sdk-mock@5.4.0
      node_modules/aws-sdk-mock
        aws-sdk-mock@"^5.1.0" from back-end@0.0.0
        back-end
          back-end@0.0.0
          node_modules/back-end
            workspace back-end from the root project
  @sinonjs/fake-timers@"^7.1.2" from sinon@11.1.2
  node_modules/aws-sdk-mock/node_modules/sinon
    sinon@"^11.1.1" from aws-sdk-mock@5.4.0
    node_modules/aws-sdk-mock
      aws-sdk-mock@"^5.1.0" from back-end@0.0.0
      back-end
        back-end@0.0.0
        node_modules/back-end
          workspace back-end from the root project

@sinonjs/fake-timers@9.1.2 dev
node_modules/sinon/node_modules/@sinonjs/fake-timers
  @sinonjs/fake-timers@"^9.1.2" from sinon@14.0.0
  node_modules/sinon
    peer sinon@">=4.0.0" from sinon-chai@3.7.0
    node_modules/sinon-chai
      dev sinon-chai@"^3.7.0" from @cof/e1-models@0.0.0
      packages/models
        @cof/e1-models@0.0.0
        node_modules/@cof/e1-models
          @cof/e1-models@"^0.0.0" from @cof/e1-workflow-module@0.0.0
          packages/workflow-module
            @cof/e1-workflow-module@0.0.0
            node_modules/@cof/e1-workflow-module
              @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
              front-end
                front-end@0.0.0
                node_modules/front-end
                  workspace front-end from the root project
              workspace packages/workflow-module from the root project
          workspace packages/models from the root project
      dev sinon-chai@"^3.7.0" from @cof/e1-util@0.0.0
      packages/util
        @cof/e1-util@0.0.0
        node_modules/@cof/e1-util
          workspace packages/util from the root project
      dev sinon-chai@"^3.7.0" from @cof/e1-validation@0.0.0
      packages/validation
        @cof/e1-validation@0.0.0
        node_modules/@cof/e1-validation
          workspace packages/validation from the root project
      dev sinon-chai@"^3.7.0" from @cof/e1-workflow-module@0.0.0
      packages/workflow-module
        @cof/e1-workflow-module@0.0.0
        node_modules/@cof/e1-workflow-module
          @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
          front-end
            front-end@0.0.0
            node_modules/front-end
              workspace front-end from the root project
          workspace packages/workflow-module from the root project
      dev sinon-chai@"^3.7.0" from back-end@0.0.0
      back-end
        back-end@0.0.0
        node_modules/back-end
          workspace back-end from the root project
    dev sinon@"^14.0.0" from @cof/e1-models@0.0.0
    packages/models
      @cof/e1-models@0.0.0
      node_modules/@cof/e1-models
        @cof/e1-models@"^0.0.0" from @cof/e1-workflow-module@0.0.0
        packages/workflow-module
          @cof/e1-workflow-module@0.0.0
          node_modules/@cof/e1-workflow-module
            @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
            front-end
              front-end@0.0.0
              node_modules/front-end
                workspace front-end from the root project
            workspace packages/workflow-module from the root project
        workspace packages/models from the root project
    dev sinon@"^14.0.0" from @cof/e1-util@0.0.0
    packages/util
      @cof/e1-util@0.0.0
      node_modules/@cof/e1-util
        workspace packages/util from the root project
    dev sinon@"^14.0.0" from @cof/e1-validation@0.0.0
    packages/validation
      @cof/e1-validation@0.0.0
      node_modules/@cof/e1-validation
        workspace packages/validation from the root project
    dev sinon@"^14.0.0" from @cof/e1-workflow-module@0.0.0
    packages/workflow-module
      @cof/e1-workflow-module@0.0.0
      node_modules/@cof/e1-workflow-module
        @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
        front-end
          front-end@0.0.0
          node_modules/front-end
            workspace front-end from the root project
        workspace packages/workflow-module from the root project
    dev sinon@"^14.0.0" from back-end@0.0.0
    back-end
      back-end@0.0.0
      node_modules/back-end
        workspace back-end from the root project
  @sinonjs/fake-timers@">=5" from nise@5.1.1
  node_modules/sinon/node_modules/nise
    nise@"^5.1.1" from sinon@14.0.0
    node_modules/sinon
      peer sinon@">=4.0.0" from sinon-chai@3.7.0
      node_modules/sinon-chai
        dev sinon-chai@"^3.7.0" from @cof/e1-models@0.0.0
        packages/models
          @cof/e1-models@0.0.0
          node_modules/@cof/e1-models
            @cof/e1-models@"^0.0.0" from @cof/e1-workflow-module@0.0.0
            packages/workflow-module
              @cof/e1-workflow-module@0.0.0
              node_modules/@cof/e1-workflow-module
                @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
                front-end
                  front-end@0.0.0
                  node_modules/front-end
                    workspace front-end from the root project
                workspace packages/workflow-module from the root project
            workspace packages/models from the root project
        dev sinon-chai@"^3.7.0" from @cof/e1-util@0.0.0
        packages/util
          @cof/e1-util@0.0.0
          node_modules/@cof/e1-util
            workspace packages/util from the root project
        dev sinon-chai@"^3.7.0" from @cof/e1-validation@0.0.0
        packages/validation
          @cof/e1-validation@0.0.0
          node_modules/@cof/e1-validation
            workspace packages/validation from the root project
        dev sinon-chai@"^3.7.0" from @cof/e1-workflow-module@0.0.0
        packages/workflow-module
          @cof/e1-workflow-module@0.0.0
          node_modules/@cof/e1-workflow-module
            @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
            front-end
              front-end@0.0.0
              node_modules/front-end
                workspace front-end from the root project
            workspace packages/workflow-module from the root project
        dev sinon-chai@"^3.7.0" from back-end@0.0.0
        back-end
          back-end@0.0.0
          node_modules/back-end
            workspace back-end from the root project
      dev sinon@"^14.0.0" from @cof/e1-models@0.0.0
      packages/models
        @cof/e1-models@0.0.0
        node_modules/@cof/e1-models
          @cof/e1-models@"^0.0.0" from @cof/e1-workflow-module@0.0.0
          packages/workflow-module
            @cof/e1-workflow-module@0.0.0
            node_modules/@cof/e1-workflow-module
              @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
              front-end
                front-end@0.0.0
                node_modules/front-end
                  workspace front-end from the root project
              workspace packages/workflow-module from the root project
          workspace packages/models from the root project
      dev sinon@"^14.0.0" from @cof/e1-util@0.0.0
      packages/util
        @cof/e1-util@0.0.0
        node_modules/@cof/e1-util
          workspace packages/util from the root project
      dev sinon@"^14.0.0" from @cof/e1-validation@0.0.0
      packages/validation
        @cof/e1-validation@0.0.0
        node_modules/@cof/e1-validation
          workspace packages/validation from the root project
      dev sinon@"^14.0.0" from @cof/e1-workflow-module@0.0.0
      packages/workflow-module
        @cof/e1-workflow-module@0.0.0
        node_modules/@cof/e1-workflow-module
          @cof/e1-workflow-module@"0.0.0" from front-end@0.0.0
          front-end
            front-end@0.0.0
            node_modules/front-end
              workspace front-end from the root project
          workspace packages/workflow-module from the root project
      dev sinon@"^14.0.0" from back-end@0.0.0
      back-end
        back-end@0.0.0
        node_modules/back-end
          workspace back-end from the root project
❯ node --version && uname -a
v16.14.2
Darwin 5c52309d33e3 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:45 PDT 2022; root:xnu-7195.141.29~1/RELEASE_X86_64 x86_64 i386 Darwin

I'm a bit baffled as this only started happening after I pulled sinon into a new workspace in our repo. So I suspect that workspace must be missing some types but what/why.

I did try adding @types/sinonjs__fake-timers, we don't even have fake timers used anywhere in our code.

benjamingr commented 2 years ago

What if you add @types/node?

xenoterracide commented 2 years ago

No, I tried that. Ultimately the problem came down to being that another module in the mono repo was indirectly depending on V7, and node resolution was messing things up.

On Tue, Jul 12, 2022, 3:19 AM Benjamin Gruenbaum @.***> wrote:

What if you add @types/node?

— Reply to this email directly, view it on GitHub https://github.com/sinonjs/fake-timers/issues/435#issuecomment-1181406834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABLDKERYI66XVXKQBFLCDVTUL7HANCNFSM53IHSPKA . You are receiving this because you authored the thread.Message ID: @.***>