Skip to content

Document typeCheck option. #512

Closed
Closed

Description

@mikelehen

I seem to be confused about what this option does. My tests (written in typescript and executed via mocha with --require ts-node/register) run just as fast with or without typeChecking (~23 seconds after clearing the cache) and catch simple type errors I've tried introducing, regardless of whether I use the typeCheck option or not.

I've tried enabling / disabling it both via the require entrypoints (ts-node/register vs ts-node/register/typeCheck) and via the environment variable (TS_NODE_TYPE_CHECK) and haven't been able to detect any difference in behavior.

Could you add some documentation on what the typeCheck option actually does and how to decide whether to enable it or not? Thanks!

Activity

  1. mikelehen commented on Jan 16, 2018

    @mikelehen
    Author

    Okay, this is really weird. When I was clearing the cache between runs, ts-node/register and ts-node/register/typecheck both took 23 seconds. But if instead I set TS_NODE_CACHE=NO, then ts-node/register/typecheck only takes 9 seconds, while ts-node/register still takes 23 seconds (which is the opposite of what I would expect!).

    My package.json has:

        "test:node":           "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --retries 5 --timeout 5000 --exit",
        "test:node:typecheck": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --retries 5 --timeout 5000 --exit",
    

    And here are my timings:

    ~/src/firebase-js-sdk/packages/firestore (mikelehen/ts-node-caching) $ time yarn test:node
    yarn run v1.2.1
    $ TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register --require index.node.ts --retries 5 --timeout 5000 --exit
    No IndexedDB. Skipping EncodedResourcePath tests.
    No IndexedDB. Skipping LocalStore w/ IndexedDB persistence tests.
    No IndexedDB. Skipping IndexedDbMutationQueue tests.
    No IndexedDB. Skipping IndexedDbQueryCache tests.
    No IndexedDB. Skipping IndexedDbRemoteDocumentCache tests.
    No IndexedDB. Skipping RemoteDocumentChangeBuffer tests.
    Skipping SimpleDb tests due to lack of indexedDB support.
    
    
      (Persistence=false) Database batch writes
        ✓ can set documents (865ms)
    
    
      1 passing (968ms)
    
    ✨  Done in 22.21s.
    
    real	0m22.556s
    user	0m24.243s
    sys	0m1.180s
    
    
    ~/src/firebase-js-sdk/packages/firestore (mikelehen/ts-node-caching) $ time yarn test:node:typecheck
    yarn run v1.2.1
    $ TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --require index.node.ts --retries 5 --timeout 5000 --exit
    No IndexedDB. Skipping EncodedResourcePath tests.
    No IndexedDB. Skipping LocalStore w/ IndexedDB persistence tests.
    No IndexedDB. Skipping IndexedDbMutationQueue tests.
    No IndexedDB. Skipping IndexedDbQueryCache tests.
    No IndexedDB. Skipping IndexedDbRemoteDocumentCache tests.
    No IndexedDB. Skipping RemoteDocumentChangeBuffer tests.
    Skipping SimpleDb tests due to lack of indexedDB support.
    
    
      (Persistence=false) Database batch writes
        ✓ can set documents (834ms)
    
    
      1 passing (839ms)
    
    ✨  Done in 8.99s.
    
    real	0m9.324s
    user	0m10.935s
    sys	0m0.423s
    
  2. nextlogic-ono commented on Feb 11, 2018

    @nextlogic-ono

    It seems current version 4.1.0 released on npm still has old options in the help.

    > ts-node --help

    Usage: ts-node [options] [ -e script | script.ts ] [arguments]

    Options:

    -e, --eval [code] Evaluate code
    -p, --print [code] Evaluate code and print result
    -r, --require [path] Require a node module for execution
    -C, --compiler [name] Specify a custom TypeScript compiler
    -I, --ignoreWarnings [code] Ignore TypeScript warnings by diagnostic code
    -P, --project [path] Path to TypeScript project (or false)
    -O, --compilerOptions [opts] JSON object to merge with compiler options
    -F, --fast Run TypeScript compilation in transpile mode
    --ignore [regexp], --no-ignore Set the ignore check (default: /node_modules/)
    --no-cache Disable the TypeScript cache
    --cache-directory Configure the TypeScript cache directory

  3. blakeembrey commented on Feb 19, 2018

    @blakeembrey
    Member

    Added with #536.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions