[js/web] release session after use in npm test (#17470)

### Description
release session after use in npm test.

This is one of the prerequisites for supporting IO binding for WebGPU
buffer in onnxruntime-web.

list of prerequisites PRs:
#17465
#17469
#17470 (this one)
This commit is contained in:
Yulong Wang 2023-09-12 16:59:13 -07:00 committed by GitHub
parent 49511b5483
commit f923eec28b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -110,9 +110,9 @@ for (const group of ORT_WEB_TEST_CONFIG.model) {
test, ORT_WEB_TEST_CONFIG.profile, ORT_WEB_TEST_CONFIG.options.sessionOptions);
});
after('release session', () => {
after('release session', async () => {
if (context) {
context.release();
await context.release();
}
});

View file

@ -210,11 +210,12 @@ export class ModelTestContext {
Logger.verbose('TestRunner.Perf', '***Perf Data End');
}
release(): void {
async release(): Promise<void> {
if (this.profile) {
this.session.endProfiling();
}
this.logPerfData();
await this.session.release();
}
/**