@trpc/server in a non-server environment Error in Azure CI

MMugetsu2/8/2023
Im trying to add vitest unit tests for my trpc procedures. I followed some examples and on the local evn all works. Tests pass but in the Azure CI I get this error.
Error: You're trying to use @trpc/server in a non-server environment. This is not supported by default.
#19 7.732  ❯ initTRPCInner node_modules/.pnpm/@trpc+server@10.8.1/node_modules/@trpc/server/dist/inde***.mjs:808:23
#19 7.732  ❯ TRPCBuilder.create node_modules/.pnpm/@trpc+server@10.8.1/node_modules/@trpc/server/dist/inde***.mjs:782:33
#19 7.732  ❯ src/server/api/trpc.ts:32:56
#19 7.734      30| import { createTRPCConte***t } from './conte***t'
#19 7.734      31| 
#19 7.734      32| const t = initTRPC.conte***t<typeof createTRPCConte***t>().create({
#19 7.734        |                                                        ^
#19 7.734      33|   transformer: superjson,
#19 7.734      34|   errorFormatter({ shape, ct*** }) {
Nnlucas2/8/2023
You've probably imported your Backend into the Frontend
Nnlucas2/8/2023
Make sure where you're importing the AppRouter you're doing import type { AppRouter } from 'backend'
Nnlucas2/8/2023
Or you just need to set up your tests project to include the Node environment, it may be browser by default
MMugetsu2/8/2023
mmm this might be it but why it works locally then
Nnlucas2/8/2023
Sometimes the mode of tools changes when CI=1 is set in the environment. This would be a weird case of that though
MMugetsu2/8/2023
@Nick Lucas Thanks for the tip! You were right. I've changed default setting for vitest from environment: 'jsdom', to per file via comment and it worked ❤️