gluegun icon indicating copy to clipboard operation
gluegun copied to clipboard

Unit tests broken for newly created project

Open ElonVolo opened this issue 2 years ago • 2 comments

Describe the bug

When I create a new gluegun project using the Typescdript option and then run npm test the tests break.

To Reproduce Steps to reproduce the behavior:

  1. Run the command gluegun new testapp
  2. Choose the option "TypeScript - Gives you a build pipeline out of the box (default)"
  3. When the project has finished generated, cd to testapp
  4. Run the command npm test
  5. See tests fail

Expected behavior

The unit tests for a newly created Typescript project pass.

Error Output


ts-jest[config] (WARN) Got `sourceMap: false` from tsconfig file "/Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/tsconfig.json". This will disable source map support in ts-jest 27. Please set `sourceMap: true` in your tsconfig file "/Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/tsconfig.json" if you want to keep source map support on
 FAIL  __tests__/cli-integration.test.ts
  ✕ outputs version (467 ms)
  ✕ outputs help (472 ms)
  ✕ generates file (461 ms)

  ● outputs version

    Command failed: node /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/bin/testapp --version

    /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/node_modules/typescript/lib/typescript.js:42536
            ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
                     ^
    Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.

      at Object.resolveTypeReferenceDirective (node_modules/typescript/lib/typescript.js:42536:18)
      at node_modules/ts-node/src/index.ts:623:55
          at Array.map (<anonymous>)
      at Object.resolveTypeReferenceDirectives (node_modules/ts-node/src/index.ts:622:33)
      at actualResolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116673:163)
      at resolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116973:26)
      at processTypeReferenceDirectives (node_modules/typescript/lib/typescript.js:118455:31)
      at findSourceFileWorker (node_modules/typescript/lib/typescript.js:118340:21)
      at findSourceFile (node_modules/typescript/lib/typescript.js:118195:26)
      at processImportedModules (node_modules/typescript/lib/typescript.js:118601:25)

  ● outputs help

    Command failed: node /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/bin/testapp --help

    /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/node_modules/typescript/lib/typescript.js:42536
            ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
                     ^
    Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.

      at Object.resolveTypeReferenceDirective (node_modules/typescript/lib/typescript.js:42536:18)
      at node_modules/ts-node/src/index.ts:623:55
          at Array.map (<anonymous>)
      at Object.resolveTypeReferenceDirectives (node_modules/ts-node/src/index.ts:622:33)
      at actualResolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116673:163)
      at resolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116973:26)
      at processTypeReferenceDirectives (node_modules/typescript/lib/typescript.js:118455:31)
      at findSourceFileWorker (node_modules/typescript/lib/typescript.js:118340:21)
      at findSourceFile (node_modules/typescript/lib/typescript.js:118195:26)
      at processImportedModules (node_modules/typescript/lib/typescript.js:118601:25)

  ● generates file

    Command failed: node /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/bin/testapp generate foo

    /Users/ilanvolow/Documents/Development/JavaScript/gluegun-test/testapp/node_modules/typescript/lib/typescript.js:42536
            ts.Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.");
                     ^
    Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself.

      at Object.resolveTypeReferenceDirective (node_modules/typescript/lib/typescript.js:42536:18)
      at node_modules/ts-node/src/index.ts:623:55
          at Array.map (<anonymous>)
      at Object.resolveTypeReferenceDirectives (node_modules/ts-node/src/index.ts:622:33)
      at actualResolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116673:163)
      at resolveTypeReferenceDirectiveNamesWorker (node_modules/typescript/lib/typescript.js:116973:26)
      at processTypeReferenceDirectives (node_modules/typescript/lib/typescript.js:118455:31)
      at findSourceFileWorker (node_modules/typescript/lib/typescript.js:118340:21)
      at findSourceFile (node_modules/typescript/lib/typescript.js:118195:26)
      at processImportedModules (node_modules/typescript/lib/typescript.js:118601:25)

Test Suites: 1 failed, 1 total
Tests:       3 failed, 3 total
Snapshots:   0 total
Time:        2.098 s, estimated 3 s

Doctor (please complete the following information):

  • MacOS Monterey 12.4 Beta
  • Gluegun 5.1.2
  • node.js 18.3.0

Additional context

The tests pass when I npm install the latest version of ts-node. .

ElonVolo avatar Jun 06 '22 16:06 ElonVolo

One addition question I have is whether the addition typescript dependencies (e.g. Typescript) should be bumped up to their latest version (e.g. 4.7.3)?

ElonVolo avatar Jun 06 '22 16:06 ElonVolo

The fix I've got up for the ejs version also seems to fix this: #764

bennetthardwick avatar Sep 01 '22 00:09 bennetthardwick