Skip to content

Commit

Permalink
Merge pull request #6 from krisl/support-bun
Browse files Browse the repository at this point in the history
Support bun
  • Loading branch information
krisl committed Sep 23, 2023
2 parents b78a47f + d06cc20 commit 300aff5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: [ "master" ]

jobs:
build:
build-node:

runs-on: ubuntu-latest

Expand All @@ -35,8 +35,21 @@ jobs:
flag-name: node-${{ join(matrix.*, '-') }}
parallel: true

finish:
needs: build
build-bun:
runs-on: ubuntu-latest
strategy:
matrix:
bun-version: [latest, canary]
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ matrix.node-version }}
- run: bun install
- run: bun test

report-coverage:
needs: build-node
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ const config: Config = {
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
clearMocks: true,
}
export default config
12 changes: 7 additions & 5 deletions src/graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,6 @@ describe('ngraph', () => {
})

describe('Components', () => {
beforeEach(() => {
// reset counts of calls using spyOn
jest.clearAllMocks()
})

describe('Lock', () => {
test('locking twice', () => {
const creator = new Graferse()
Expand All @@ -1175,6 +1170,10 @@ describe('Components', () => {
expect(linkLock.requestLock('test', 'up')).toEqual("FREE")
expect(logSpyWarn).toHaveBeenCalled()
expect(logSpyError).toHaveBeenCalled()

// needed for bun until resetAllMocks is available
logSpyWarn.mockReset()
logSpyError.mockReset()
})

describe('Locking in both directions', () => {
Expand Down Expand Up @@ -1274,6 +1273,9 @@ describe('Exceptions', () => {
expect(nodeA.isLocked()).toBeFalsy()
expect(nodeB.isLocked()).toBeFalsy()
expect(nodeC.isLocked()).toBeFalsy()

// needed for bun until resetAllMocks is available
logSpyError.mockReset()
})
test('arrivedAt bounds', () => {
const getLockForLink = (from: Lock, to: Lock) => {
Expand Down

0 comments on commit 300aff5

Please sign in to comment.