Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
grossvogel committed May 15, 2024
1 parent a542a2d commit a950250
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ jobs:
- run: mix compile
- run: npm install --prefix=test/js
- run: mix test
- if: matrix.elixir == '1.16'
run: mix format --check-formatted
10 changes: 5 additions & 5 deletions lib/nodejs/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule NodeJS.Worker do
# This random looking string makes sure that other things writing to
# stdout do not interfere with the protocol that we rely on here.
# All protocol messages start with this string.
@prefix '__elixirnodejs__UOSBsDUP6bp9IF5__'
@prefix ~c"__elixirnodejs__UOSBsDUP6bp9IF5__"

@moduledoc """
A genserver that controls the starting of the node service
Expand Down Expand Up @@ -52,8 +52,8 @@ defmodule NodeJS.Worker do
{:spawn_executable, node},
line: @read_chunk_size,
env: [
{'NODE_PATH', node_path(module_path)},
{'WRITE_CHUNK_SIZE', String.to_charlist("#{@read_chunk_size}")}
{~c"NODE_PATH", node_path(module_path)},
{~c"WRITE_CHUNK_SIZE", String.to_charlist("#{@read_chunk_size}")}
],
args: [node_service_path()]
)
Expand All @@ -76,7 +76,7 @@ defmodule NodeJS.Worker do
{:ok, protocol_data}

_ ->
get_response('', timeout)
get_response(~c"", timeout)
end
end
after
Expand All @@ -101,7 +101,7 @@ defmodule NodeJS.Worker do
body = Jason.encode!([Tuple.to_list(module), args])
Port.command(port, "#{body}\n")

case get_response('', timeout) do
case get_response(~c"", timeout) do
{:ok, response} ->
decoded_response =
response
Expand Down
4 changes: 3 additions & 1 deletion test/nodejs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ defmodule NodeJS.Test do

test "object does not exist" do
assert {:error, msg} = NodeJS.call({"keyed-functions", :idontexist, :foo})
assert js_error_message(msg) === "TypeError: Cannot read properties of undefined (reading 'foo')"

assert js_error_message(msg) ===
"TypeError: Cannot read properties of undefined (reading 'foo')"
end
end

Expand Down

0 comments on commit a950250

Please sign in to comment.