Jordan-Hall / nx-bun

https://jordan-hall.github.io/nx-bun/
Other
58 stars 6 forks source link

Running tests using bun #6

Closed barrymichaeldoyle closed 9 months ago

barrymichaeldoyle commented 9 months ago

Hey there, I see this project is basically the go to for using bun with nx.

I want to use bun to run my unit tests. Do you know the best way to implement that in an existing nx project (using the latest version of nx).

I'm not really familiar with using community nx plugins.

Jordan-Hall commented 9 months ago

npm install @nx-bun/nx -D

then run the init npx nx generate @nx-bun/nx:init --no-interactive

Add the following into project.json file

{
    executor: '@nx-bun/nx:test',
    options: {
      smol: false,
      bail: true,
      bun: true
    }
  }

This should get you started, you will need to import the tests for bun suite import {text, expect, describe} from 'bun:test

In the next version it will allow you to set the tsconfig. https://github.com/Jordan-Hall/nx-bun/pull/5

barrymichaeldoyle commented 9 months ago

Excellent, thanks! I'll give this a shot at work tomorrow :)

Jordan-Hall commented 9 months ago

I've completed the refactoring so you should be able to add the tsconfig in the options now. Its more inline with nx. Any issues just comment and I'll take a look