atk / solid-register

MIT License
18 stars 1 forks source link

Errors when running on Windows #1

Closed thm76 closed 3 years ago

thm76 commented 3 years ago

I followed https://dev.to/lexlohr/testing-solidjs-code-beyond-jest-39p on a Windows machine, and getting errors:

$ npm test

> solid-coverage@1.0.0 test
> uvu -r solid-register

TypeError: (0 , _web.template) is not a function
    at Object.<anonymous> (C:\Users\tjm684\Projects\experiments\solid-coverage\src\test\MyComponent.tsx:12:34)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module.mod._compile (C:\Users\tjm684\Projects\experiments\solid-coverage\node_modules\solid-register\dist\register-extension.js:13:38)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at require.extensions.<computed> (C:\Users\tjm684\Projects\experiments\solid-coverage\node_modules\solid-register\dist\register-extension.js:14:13)
    at Object.require.extensions.<computed> [as .tsx] (C:\Users\tjm684\Projects\experiments\solid-coverage\node_modules\solid-register\dist\compile-aliases.js:32:13)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
$ node --version
v16.13.0

Exact same code works on macOS, using same node version

atk commented 3 years ago

Thanks for writing this issue. I think I know what happens. The predefined aliases are for unixoid file systems. If I'm not mistaken, a workaround would be to run node --conditions development node_modules/.bin/uvu -r solid-register. I'll publish a fix later today (GMT+2).

Unfortunately, I had no windows machine to test this on and I wanted to publish the article asap so people could use it.

thm76 commented 3 years ago

Thanks for the quick reply.

This is what I'm getting now:

$ node --conditions development node_modules/.bin/uvu -r solid-register
C:\Users\xxx\Projects\experiments\solid-coverage\node_modules\.bin\uvu:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
?[90m    at Object.compileFunction (node:vm:352:18)?[39m
?[90m    at wrapSafe (node:internal/modules/cjs/loader:1031:15)?[39m
?[90m    at Module._compile (node:internal/modules/cjs/loader:1065:27)?[39m
?[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)?[39m
?[90m    at Module.load (node:internal/modules/cjs/loader:981:32)?[39m
?[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)?[39m
?[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)?[39m
?[90m    at node:internal/main/run_main_module:17:47?[39m

Cheers

atk commented 3 years ago

Damn, it's the same error in read-config.ts. I'll try to fix both asap. Wait, that's not code from solid-register or uvu, if I'm not mistaken. It seems node attempts to run a shell script here. Can you elaborate a bit more about your setup?

atk commented 3 years ago

OK, I fixed the obvious bugs in solid-register@0.0.8. Can you please test? I assume that script is either part of the node module loader in win32 or some external package, i.e. for coverage reporting.

atk commented 3 years ago

Tested it and it works.

thm76 commented 3 years ago

0.0.8 works. Thanks!