diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d5f8776 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish + +on: + workflow_dispatch: + inputs: + npm-tag: + description: 'NPM tag to publish the package (e.g., latest, beta, etc.)' + required: false + default: 'latest' + type: string + dry-run: + description: 'Perform a dry run (true/false)' + required: false + default: false + type: boolean + +jobs: + publish: + uses: WJSoftware/cicd/.github/workflows/npm-publish.yml@v0.4 + with: + node-version: 24 + build-script: build + test-script: test + npm-tag: ${{ inputs.npm-tag || 'latest' }} + dry-run: ${{ inputs.dry-run || false }} + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dfd0af5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,14 @@ +name: Unit Testing + +on: + pull_request: + branches: [ main ] + +jobs: + test: + uses: WJSoftware/cicd/.github/workflows/npm-test.yml@v0.4 + with: + node-version: 24 + build-script: build + test-script: test + build: true diff --git a/tests/ut/sync/AutoResetEvent.test.ts b/tests/ut/sync/AutoResetEvent.test.ts index f68b6c3..78d2962 100644 --- a/tests/ut/sync/AutoResetEvent.test.ts +++ b/tests/ut/sync/AutoResetEvent.test.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; import { sinon } from '../../setup.js'; import { AutoResetEvent } from '../../../src/sync/AutoResetEvent.js'; import { autoResetEventIdentityData } from '../../../src/sync/identifiers.js'; -import { testAutoResetEventWaitInWorker } from '../helpers/helpers.js'; +import { delay, testAutoResetEventWaitInWorker } from '../helpers/helpers.js'; import { ManualResetEvent } from '../../../src/sync/ManualResetEvent.js'; describe('AutoResetEvent', () => { @@ -87,6 +87,7 @@ describe('AutoResetEvent', () => { it('Should wait and succeed when signal becomes available.', async () => { const waitComplete = (await testAutoResetEventWaitInWorker(eventObj.token, 1000)).wait; + await delay(50); // Ensure the worker is waiting eventObj.signal(); const result = await waitComplete; diff --git a/tests/ut/sync/ManualResetEvent.test.ts b/tests/ut/sync/ManualResetEvent.test.ts index e328e37..3aa8f85 100644 --- a/tests/ut/sync/ManualResetEvent.test.ts +++ b/tests/ut/sync/ManualResetEvent.test.ts @@ -2,7 +2,7 @@ import { describe, it, beforeEach } from 'mocha'; import { expect } from 'chai'; import { sinon } from '../../setup.js'; import { ManualResetEvent } from '../../../src/sync/ManualResetEvent.js'; -import { testManualResetEventWaitInWorker, tokenTypeTest } from '../helpers/helpers.js'; +import { delay, testManualResetEventWaitInWorker, tokenTypeTest } from '../helpers/helpers.js'; import { manualResetEventIdentityData } from '../../../src/sync/identifiers.js'; import { AutoResetEvent } from '../../../src/sync/AutoResetEvent.js'; @@ -80,6 +80,7 @@ describe('ManualResetEvent', () => { it('Should wait and succeed when signal becomes available.', async () => { const waitComplete = (await testManualResetEventWaitInWorker(eventObj.token, 1000)).wait; + await delay(50); // Ensure the worker is waiting eventObj.signal(); const result = await waitComplete;