Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI #4

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-message-port'"
needs: [static_analysis, tests, sass_spec]
needs: [static_analysis, tests]

steps:
- uses: actions/checkout@v4
Expand Down
10 changes: 5 additions & 5 deletions lib/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('SyncMessagePort', () => {
port.close();
}, 100);
`,
channel.port2
channel.port2,
);

expect(port.receiveMessage()).toEqual('done!');
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('SyncMessagePort', () => {
port.postMessage('done!');
port.close();
`,
channel.port2
channel.port2,
);

expect(port.receiveMessage()).toEqual('message1');
Expand Down Expand Up @@ -152,22 +152,22 @@ function spawnWorker(source: string, port: MessagePort): Worker {
file,
`
const {SyncMessagePort} = require(${JSON.stringify(
p.join(p.dirname(__filename), 'index')
p.join(p.dirname(__filename), 'index'),
)});
const {workerData} = require('worker_threads');

const port = new SyncMessagePort(workerData);

${source}
`
`,
);

const worker = new Worker(
`
require('ts-node').register();
require(${JSON.stringify(p.resolve(file.substring(0, file.length - 3)))});
`,
{eval: true, workerData: port, transferList: [port]}
{eval: true, workerData: port, transferList: [port]},
);

worker.on('error', error => {
Expand Down
10 changes: 5 additions & 5 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SyncMessagePort extends EventEmitter {
if (!buffer) {
throw new Error(
'new SyncMessagePort() must be passed a port from ' +
'SyncMessagePort.createChannel().'
'SyncMessagePort.createChannel().',
);
}
this.buffer = new Int32Array(buffer as SharedArrayBuffer);
Expand All @@ -87,7 +87,7 @@ export class SyncMessagePort extends EventEmitter {
this.port.on(event, listener);
});
this.on('removeListener', (event, listener) =>
this.port.removeListener(event, listener)
this.port.removeListener(event, listener),
);
}

Expand All @@ -103,7 +103,7 @@ export class SyncMessagePort extends EventEmitter {
this.buffer,
0,
BufferState.AwaitingMessage,
BufferState.MessageSent
BufferState.MessageSent,
) === BufferState.AwaitingMessage
) {
Atomics.notify(this.buffer, 0);
Expand All @@ -127,7 +127,7 @@ export class SyncMessagePort extends EventEmitter {
if (this.listenerCount('message')) {
throw new Error(
'SyncMessageChannel.receiveMessage() may not be called while there ' +
'are message listeners.'
'are message listeners.',
);
}

Expand All @@ -141,7 +141,7 @@ export class SyncMessagePort extends EventEmitter {
this.buffer,
0,
BufferState.MessageSent,
BufferState.AwaitingMessage
BufferState.AwaitingMessage,
) === BufferState.Closed
) {
throw new Error("The SyncMessagePort's channel is closed.");
Expand Down