adamzapasnik / vscode-elixir-test-explorer

VSCode Elixir test explorer
16 stars 13 forks source link

Error: TypeError: Cannot read property '0' of null #7

Open jonathanstiansen opened 3 years ago

jonathanstiansen commented 3 years ago

Hey folks, All I see in the test explorer is this: image

and the "output" when I click on that is this: Error: TypeError: Cannot read property '0' of null

let me know what kind of config I can give you to help debug - I don't even know where to start other than the output.

mix test works just fine in the terminal 🤷🏽

adamzapasnik commented 3 years ago

hey @jonathanstiansen apologies for the late response

which Elixir version are you using? Is it an umbrella project?

could you run mix test --trace --seed=0 --only="" (this is a commend we use to gather all tests)

The output will look more or less like this:

EncryptedSecretsTest.ReadSecretsTest.ReadIntoFile [test/encrypted_secrets/read_secrets_test.exs]
  * test successfully reads encrypted secrets into tempfile (excluded) [L#54]
  * test returns error if input file can't be read (excluded) [L#66]
  * test returns error if input file can't be decrypted (excluded) [L#73]

Are there any cases where this part [L#NUMBER] is missing?

It's okay if there are cases without a "list". Like this one:

EncryptedSecretsTest.ReadSecretsTest [test/encrypted_secrets/read_secrets_test.exs]

The other way to debug it would be to find which file(s) is causing this. Unfortunately, I don't have any other idea how to deal with this, sorry.

Maxim-Filimonov commented 3 years ago

Same problem here. I did try to run mix test --trace --seed=0 --only="" I don't see any missing [L#number] cases. Versions:

erlang 23.3.4.3
elixir 1.11.3-otp-23
thecristen commented 1 year ago

I have this problem too. It's a large (1665 tests) umbrella app. In my case every test has [L#NUMBER] missing.

Versions:

erlang 22.3.4.26
elixir 1.10.4-otp-22
adamzapasnik commented 1 year ago

@thecristen could you show an example of the output? You can change test/file names, I'm curious about the format.

thecristen commented 1 year ago

@adamzapasnik sure! attempt at a representative excerpt:

SiteWeb.Plugs.StaticTest
  * test apple-touch-icon redirects returns apple-touch-icon if we request apple-touch-icon-*.png (excluded)
  * test apple-touch-icon redirects does not return apple-touch-icon if we request /path/apple-touch-icon.png (excluded)
  * test apple-touch-icon redirects ignores other URLs (excluded)

SiteWeb.Plugs.UriCheckerTest
  * test URI checker does nothing because URI is not malformed (excluded)
  * test URI checker redirects with a 404 because URI is malformed (excluded)

SiteWeb.Plugs.YearMonthTest
  * test call/2 basic assigns (excluded)
  * test call/2 defaults to current (excluded)
  * test call/2 defaults if invalid params (excluded)

Phoenix.Router.RoutingTest
  * test routes Proposed Sales Locations page (excluded)
  * test redirects yawkey redirect (excluded)
  * test redirects Nubian redirect (excluded)
  * test redirects SL buses (excluded)
  * test redirects CT buses (excluded)
  * test redirects routes eliminated by Better Bus Project (excluded)
  * test redirects trip planner with 'to' but without an address (excluded)
  * test redirects redirect to canonical host securely (excluded)
  * test Adds noindex x-robots-tag HTTP header if config set (excluded)
  * test Assigns cookie for known flagged features via URL params (excluded)

CustomerSupportViewTest
  * test show_error_message/1 is true when there are errors and the form is shown (excluded)
  * test show_error_message/1 is false when there are no errors (excluded)
  * test show_error_message/1 is false when the form is not shown (excluded)

SiteWeb.CmsRouterHelpersTest
  * test news_entry_path/3 handles :index (excluded)
  * test news_entry_path/3 handles :show with no path_alias (excluded)
  * test news_entry_path/3 handles :show with path_alias (excluded)
  * test news_entry_path/3 handles :show with non-conforming path_alias (excluded)
  * test news_entry_path/4 handles :show (excluded)
  * test event_path/3 handles :index (excluded)
  * test event_path/3 handles :show with no path_alias (excluded)
  * test event_path/3 handles :show with path_alias (excluded)
  * test event_path/3 handles :show with non-conforming path_alias (excluded)
  * test event_path/4 handles :show (excluded)
  * test project_path/3 handles :index (excluded)
  * test project_path/3 handles :show with no path_alias (excluded)
  * test project_path/3 handles :show with path_alias (excluded)
  * test project_path/3 handles :show with teaser (excluded)
  * test project_path/3 handles :show with project name (excluded)
  * test project_update_path/3 handles :project_update with no path alias (excluded)
  * test project_update_path/3 handles :project_update with path alias (excluded)
  * test project_update_path/4 handles :project_update (excluded)

TripInfoTest
  * test from_list/1 creates a TripInfo from a list of PredictedSchedules (excluded)
  * test from_list/1 creates a TripInfo with origin/destination even when they are passed in as nil (excluded)
  * test from_list/1 creates a TripInfo even when the first or last prediction time is nil (excluded)
  * test from_list/1 given an origin, limits the times to just those after origin (excluded)
  * test from_list/1 given an origin and destination, limits both sides (excluded)
  * test from_list/1 given an origin, does not care if the destination is the same as the origin (excluded)

One thing I'm realizing is we have a few compiler warnings, but I think those technically happen right before executing the test listing command.

(edited to remove link to output text)

adamzapasnik commented 1 year ago

@thecristen thanks, you can remove the outputs 🙇

https://github.com/elixir-lang/elixir/blob/v1.11/CHANGELOG.md#exunit-1

[ExUnit] Add file and line to ExUnit's --trace

Line and file information was added in Elixir v1.11, so this extension won't work with 1.10 :( I'll add this information to readme.