diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 875f05a..ce4e43d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -10,7 +10,7 @@ on: branches: [ "master" ] jobs: - build: + build-node: runs-on: ubuntu-latest @@ -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: diff --git a/jest.config.ts b/jest.config.ts index f8dce43..34ad0fc 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -5,5 +5,6 @@ const config: Config = { moduleNameMapper: { '^(\\.{1,2}/.*)\\.js$': '$1', }, + clearMocks: true, } export default config diff --git a/src/graph.test.ts b/src/graph.test.ts index 9e3d31a..3c6571c 100644 --- a/src/graph.test.ts +++ b/src/graph.test.ts @@ -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() @@ -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', () => { @@ -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) => {