`SyntaxError: The requested module 'ws' does not p...
# general
m
SyntaxError: The requested module 'ws' does not provide an export named 'WebSocketServer'
Getting this on another project too after updating (1.2.9)
f
Thought this was fixed in v1.2.3. Pulling in @thdxr.
t
I'm unable to recreate this. The original error came from upgrading ws and they had renamed Server to WebSocketServer. So seeing this error suggests sst is trying to use an older version of ws
But not sure how
t
trying this now
oh are you using pnpm?
m
i'm giving it a whirl
t
I really like it but I think we have some work to do in sst to fix some things that break
hm it worked for me
m
interesting
t
that was with npm though let me try pnpm
pnpm doesn't work but it's a different issue
m
Copy code
➜  sst-prisma git:(lint-prettier) pnpm test

> myapp@0.1.0 test /Users/cyber/dev/sst-prisma
> pnpm run jest


> myapp@0.1.0 jest /Users/cyber/dev/sst-prisma
> NODE_OPTIONS='--experimental-vm-modules' node_modules/.bin/jest

(node:17356) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
 PASS  src/db/client.test.ts
 PASS  src/api/resolver/greeting.test.ts
 FAIL  stacks/main.test.ts
  ● Test suite failed to run

    SyntaxError: The requested module 'ws' does not provide an export named 'WebSocketServer'

      at Runtime.linkAndEvaluateModule (node_modules/.pnpm/jest-runtime@27.5.1/node_modules/jest-runtime/build/index.js:779:5)
      at TestScheduler.scheduleTests (node_modules/.pnpm/@jest+core@27.5.1/node_modules/@jest/core/build/TestScheduler.js:333:13)
      at runJest (node_modules/.pnpm/@jest+core@27.5.1/node_modules/@jest/core/build/runJest.js:404:19)
      at _run10000 (node_modules/.pnpm/@jest+core@27.5.1/node_modules/@jest/core/build/cli/index.js:320:7)
      at runCLI (node_modules/.pnpm/@jest+core@27.5.1/node_modules/@jest/core/build/cli/index.js:173:3)
is what i see on my machine and GHA
same with
npm test
t
oh running test sorry was doing sst start
m
its very possible its some jest BS
t
I think both sst/core and jest depend on
ws
and it seems to be using the jest version
m
yeah
t
did you consider using vitest for this? I found everything behaves better and just works out of the box
and the tests still look the same
m
i am using
jest-esbuild
but could try vitest
wack
t
the one change with vitest is you have t oimport
it
test
describe
etc
m
yeah i'm enabling
globals