question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Left side of comma operator is unused and has no side effect (v27.1.3)

See original GitHub issue

Version

27.1.3

Steps to reproduce

Reproduction steps:

  1. Clone my repository at https://github.com/flo-sch/ts-jest-27-1-3-issue-reproduction-global-teardown
  2. Follow the instructions in README.md to both get started and reproduce the bug

The setup is a bit complicated since the tests are backed by a postgresql database, hopefully the instructions are clear enough

Expected behavior

Updating ts-jest from v27.1.2 to v27.1.3 should not break my tests

Actual behavior

Something in v27.1.3 make my tests fail with an error message

Debug log

{“category”:1,“code”:17016,“key”:“The_jsxFragmentFactory_compiler_option_must_be_provided_to_use_JSX_fragments_with_the_jsxFactory_com_17016”,“message”:“The ‘jsxFragmentFactory’ compiler option must be provided to use JSX fragments with the ‘jsxFactory’ compiler option.”},“The_last_overload_gave_the_following_error”:{“category”:1,“code”:2770,“key”:“The_last_overload_gave_the_following_error_2770”,“message”:“The last overload gave the following error.”},“The_last_overload_is_declared_here”:{“category”:1,“code”:2771,“key”:“The_last_overload_is_declared_here_2771”,“message”:“The last overload is declared here.”},“The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern”:{“category”:1,“code”:2491,“key”:“The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491”,“message”:“The left-hand side of a ‘for…in’ statement cannot be a destructuring pattern.”},“The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation”:{“category”:1,“code”:2404,“key”:“The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404”,“message”:“The left-hand side of a ‘for…in’ statement cannot use a type annotation.”},“The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access”:{“category”:1,“code”:2780,“key”:“The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access_2780”,“message”:“The left-hand side of a ‘for…in’ statement may not be an optional property access.”},“The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access”:{“category”:1,“code”:2406,“key”:“The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406”,“message”:“The left-hand side of a ‘for…in’ statement must be a variable or a property access.”},“The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any”:{“category”:1,“code”:2405,“key”:“The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405”,“message”:“The left-hand side of a ‘for…in’ statement must be of type ‘string’ or ‘any’.”},“The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation”:{“category”:1,“code”:2483,“key”:“The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483”,“message”:“The left-hand side of a ‘for…of’ statement cannot use a type annotation.”},“The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access”:{“category”:1,“code”:2781,“key”:“The_left_hand_side_of_a_for_of_statement_may_not_be_an_optional_property_access_2781”,“message”:“The left-hand side of a ‘for…of’ statement may not be an optional property access.”},“The_left_hand_side_of_a_for_of_statement_may_not_be_async”:{“category”:1,“code”:1106,“key”:“The_left_hand_side_of_a_for_of_statement_may_not_be_async_1106”,“message”:“The left-hand side of a ‘for…of’ statement may not be ‘async’.”},“The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access”:{“category”:1,“code”:2487,“key”:“The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487”,“message”:“The left-hand side of a ‘for…of’ statement must be a variable or a property access.”},“The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type”:{“category”:1,“code”:2362,“key”:“The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362”,“message”:“The left-hand side of an arithmetic operation must be of type ‘any’, ‘number’, ‘bigint’ or an enum type.”},“The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access”:{“category”:1,“code”:2779,“key”:“The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779”,“message”:“The left-hand side of an assignment expression may not be an optional property access.”},“The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access”:{“category”:1,“code”:2364,“key”:“The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364”,“message”:“The left-hand side of an assignment expression must be a variable or a property access.”},“The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol”:{“category”:1,“code”:2360,“key”:“The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360”,“message”:“The left-hand side of an ‘in’ expression must be a private identifier or of type ‘any’, ‘string’, ‘number’, or ‘symbol’.”},“The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter”:{“category”:1,“code”:2358,“key”:“The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358”,“message”:“The left-hand side of an ‘instanceof’ expression must be of type ‘any’, an object type or a type parameter.”},“The_locale_used_when_displaying_messages_to_the_user_e_g_en_us”:{“category”:3,“code”:6156,“key”:“The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156”,“message”:“The locale used when displaying messages to the user (e.g. ‘en-us’)”},“The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files”:{“category”:3,“code”:6136,“key”:“The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136”,“message”:“The maximum dependency depth to search under node_modules and load JavaScript files.”},

Additional context

Hi,

I am running integration tests on a Fastify server application backed by a postgresql database, within a https://nx.dev monorepository workspace.

While the jest setup seems a bit flaky to me, tests successfully run using ts-jest 27.1.2.

Migrating to 27.1.3 however make them fail with the following message (as illustrated in the repository branch):

[TSError: apps/example-app-integration/jest/globalTeardown.ts:5:13 - error TS2695: Left side of comma operator is unused and has no side effects.

I am not fully sure if ts-jest in itself is the problem, perhaps it is how I register my global scripts, but cannot figure out what the issue is, technically 😅

Environment

System:
  OS: macOS 12.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
  Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
  Yarn: 1.22.17 - /usr/local/bin/yarn
  npm: 8.3.1 - ~/.nvm/versions/node/v16.13.2/bin/npm
npmPackages:
  jest: ^27.5 => 27.5.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
alko89commented, May 20, 2022

I’m having the same issue in globalTeardown, globalSetup works fine. I’ve updated jest and ts-jest to v28 and get the same error.

1reaction
ahnpnlcommented, Mar 12, 2022

I’d recommend to stay on 27.1.2 since 27.1.3 doesn’t contain anything important. We are likely going to change internal ts-jest in v28 which will likely fix this issue.

Besides, it would be more helpful if your repo can be smaller so we can get a chance to test this bug without complex setup with postgresql.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript - Left side of comma operator is unused and has no ...
The syntax for a computed property name in an object literal is [someExpression] , not `${someExpression}` : const root = "/"; const routes ......
Read more >
React: Left side of comma operator is unused and has no side ...
The render function of a React component expects a single element to be returned here but you're passing two, the h1 and h2...
Read more >
CoffeeScript
Sometimes functions end with loops that are intended to run only for their side-effects. Be careful that you're not accidentally returning the results...
Read more >
Downloads - Duktape
2017-04-15, duktape-2.1.0.tar.xz, performance, side effect handling, ... Fix RegExp exec() result object creation bug when Array.prototype has index ...
Read more >
Changelog — Python 3.11.1 documentation
gh-97527: Fix a bug in the previous bugfix that caused IDLE to not start when run with 3.10.8, 3.12.0a1, and at least Microsoft...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found