Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7078919
Draft: validation in worker thread
juslesan Dec 22, 2025
9bf8431
package-lock
juslesan Dec 22, 2025
19ce5d7
DestroySignal to tests
juslesan Dec 22, 2025
c4586b8
eslint
juslesan Dec 22, 2025
c2a74ed
npm run version
juslesan Dec 22, 2025
2dd5dd4
refactors
juslesan Dec 22, 2025
d6481e2
fix issue with StreamMessage passing
juslesan Dec 22, 2025
46a9c6f
revert
juslesan Dec 22, 2025
d31d1c1
nodejs workers for validation
juslesan Dec 22, 2025
360dfdc
most unit tests work now
juslesan Dec 22, 2025
494cc21
SignatureValidationData
juslesan Dec 22, 2025
4741a17
esöint
juslesan Dec 22, 2025
49ba698
increase tiemout
juslesan Jan 12, 2026
cf1fc06
Merge branch 'main' into NET-1663-validation
juslesan Jan 15, 2026
8eef444
process.exit(0) after a comand is completed to avoid hanging because …
juslesan Jan 20, 2026
642d7a1
Merge branch 'main' into NET-1663-validation
juslesan Jan 20, 2026
bde83db
destroy ServerSignatureValidation worker
juslesan Jan 20, 2026
558ee87
fix resend.ts
juslesan Jan 20, 2026
72632f4
Merge remote-tracking branch 'origin/main' into NET-1663-validation
mondoreale Jan 27, 2026
31dbc7d
Install `web-worker`
mondoreale Jan 27, 2026
cce4c35
Refactor signature validation – use `web-worker` to unify worker code…
mondoreale Jan 27, 2026
364baf1
Rename `signatureValidation` to `signatureValidationUtils`
mondoreale Jan 27, 2026
5fb810b
Fix filenames
mondoreale Jan 27, 2026
9f2ab70
Use named exports from `comlink`
mondoreale Jan 27, 2026
a7c4f0f
Custom expose for nodejs (using Comlink's `nodeAdapter`)
mondoreale Jan 27, 2026
21b3c6e
Release proxy
mondoreale Jan 27, 2026
53a1173
Merge remote-tracking branch 'origin/main' into NET-1663-validation-2
mondoreale Jan 28, 2026
c45177f
Fix signature validation tests
mondoreale Jan 28, 2026
856a012
Fix SDK's browser tests
mondoreale Jan 28, 2026
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
106 changes: 60 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions packages/browser-test-runner/src/createKarmaConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ import type { Configuration, ExternalItem } from 'webpack'

const DEBUG_MODE = process.env.BROWSER_TEST_DEBUG_MODE ?? false

export interface KarmaConfigOptions {
// File patterns to serve but not include in the test bundle (e.g. worker files)
servedFiles?: string[]
}

export const createKarmaConfig = (
testPaths: string[], webpackConfig: () => Configuration, localDirectory?: string
testPaths: string[],
webpackConfig: () => Configuration,
localDirectory?: string,
options: KarmaConfigOptions = {}
): (config: any) => any => {
const setupFiles = [fileURLToPath(new URL('./karma-setup.js', import.meta.url))]

Expand Down Expand Up @@ -57,7 +65,13 @@ export const createKarmaConfig = (
reporters: ['spec'],
files: [
...setupFiles,
...testPaths
...testPaths,
...(options.servedFiles ?? []).map((pattern) => ({
pattern,
included: false,
served: true,
watched: false
}))
],
preprocessors,
customLaunchers: {
Expand Down
1 change: 1 addition & 0 deletions packages/browser-test-runner/src/exports.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { createKarmaConfig } from './createKarmaConfig'
export type { KarmaConfigOptions } from './createKarmaConfig'
export { createWebpackConfig } from './createWebpackConfig'
2 changes: 2 additions & 0 deletions packages/cli-tools/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export const createClientCommand = (
await client.destroy()
}
}
// Exit cleanly after command completes - worker threads may keep event loop alive
process.exit(0)
} catch (e: any) {
console.error(e)
process.exit(1)
Expand Down
11 changes: 7 additions & 4 deletions packages/cli-tools/src/resend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ export const resend = async (
subscribe: boolean
): Promise<void> => {
try {
const handler = (message: any) => {
console.info(JSON.stringify(message))
}
if (subscribe) {
const handler = (message: any) => {
console.info(JSON.stringify(message))
}
await client.subscribe({
stream: streamId,
resend: resendOpts
}, handler)
} else {
await client.resend(streamId, resendOpts, handler)
const messageStream = await client.resend(streamId, resendOpts)
for await (const message of messageStream) {
console.info(JSON.stringify(message.content))
}
}
} catch (err) {
console.error(err.message ?? err)
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/createKarmaConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function createKarmaConfig(testPaths: string[]): ReturnType<typeof create
'test/test-utils/jestGlobalsMock.ts'
),
'@streamr/dht': resolve(__dirname, '../dht/dist/exports-browser.cjs'),
"@/createSignatureValidationWorker": resolve(__dirname, 'src/_karma/createSignatureValidationWorker.ts'),
'@': resolve(__dirname, 'src/_browser'),
},
fallback: {
Expand All @@ -30,6 +31,9 @@ export function createKarmaConfig(testPaths: string[]): ReturnType<typeof create
'node:timers/promises': 'timers/promises',
},
}),
__dirname
__dirname,
{
servedFiles: ['dist/*.mjs']
}
)
}
1 change: 1 addition & 0 deletions packages/sdk/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const config: Config.InitialOptions = {
'@streamr/test-utils/setupCustomMatchers',
],
moduleNameMapper: {
"^@/createSignatureValidationWorker$": "<rootDir>/src/_jest/createSignatureValidationWorker.ts",
"^@/(.*)$": "<rootDir>/src/_nodejs/$1",
},
transform: {
Expand Down
Loading