tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.22k stars 464 forks source link

Testing library-using code in Jest results in SyntaxError: Unexpected token 'export' #1627

Closed moonman239 closed 3 months ago

moonman239 commented 3 months ago

Expected behaviour:

When I test code that uses the MSSQL library, the test should run without issue.

Actual behaviour:

 SyntaxError: Unexpected token 'export'

      17 | };
      18 | /**
    > 19 |  *
         |              ^
      20 |  * @returns If successful, a MSSQL connection pool. Else, NULL.
      21 |  */
      22 |

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
      at Object.<anonymous> (node_modules/@azure/msal-node/dist/crypto/GuidGenerator.cjs:5:12)
      at Object.<anonymous> (node_modules/@azure/msal-node/dist/crypto/CryptoProvider.cjs:5:21)
      at Object.<anonymous> (node_modules/@azure/msal-node/dist/client/ClientApplication.cjs:7:22)
      at Object.<anonymous> (node_modules/@azure/msal-node/dist/client/PublicClientApplication.cjs:7:25)
      at Object.<anonymous> (node_modules/@azure/msal-node/dist/index.cjs:6:31)
      at Object.<anonymous> (node_modules/@azure/identity/dist/index.js:5:18)
      at Object.<anonymous> (node_modules/tedious/src/connection.ts:12:1)
      at Object.<anonymous> (node_modules/tedious/src/tedious.ts:2:1)
      at Object.<anonymous> (node_modules/mssql/lib/tedious/connection-pool.js:3:13)
      at Object.<anonymous> (node_modules/mssql/lib/tedious/index.js:4:24)
      at Object.<anonymous> (node_modules/mssql/index.js:1:182)
      at Object.<anonymous> (app/api/databaseStuff/database.ts:19:55)
      at Object.<anonymous> (__tests__/subscriptionTable.ts:13:19)

Configuration:

Software versions

dhensby commented 3 months ago

You haven't provided any replication code whatsoever. Your error is pointing to a comment, so I really can't help with that.

This doesn't look like any kind of bug, just you're struggling to integrate the code with your testing framework, so I'm going to close this until you can provide some details about a bug that may be present.