From 024fb8b713c827d28eb48890b8efe4f5d387792a Mon Sep 17 00:00:00 2001 From: l3ops Date: Mon, 28 Nov 2022 16:21:07 +0100 Subject: [PATCH] fix(js-api): fix the JS API tests --- npm/js-api/src/index.ts | 14 +------------- .../tests/__snapshots__/lintContent.test.ts.snap | 11 ++--------- npm/js-api/tsconfig.json | 1 - 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/npm/js-api/src/index.ts b/npm/js-api/src/index.ts index c6dabf78b01..96acc0ecaa2 100644 --- a/npm/js-api/src/index.ts +++ b/npm/js-api/src/index.ts @@ -89,22 +89,11 @@ export interface PrintDiagnosticsOptions { verbose?: boolean; } -// If `FinalizationRegistry` is supported, use it as a safety measure to ensure -// Workspace instances get deallocated in case `shutdown` isn't called -let registry: FinalizationRegistry | null = null; -if (typeof FinalizationRegistry === "function") { - registry = new FinalizationRegistry((workspace) => { - workspace.free(); - }); -} - export class Rome { private constructor( private readonly module: WasmModule, private readonly workspace: Workspace, - ) { - registry?.register(this, workspace); - } + ) {} /** * It creates a new instance of the class {Rome}. @@ -122,7 +111,6 @@ export class Rome { * unusable as calling any method on it will fail */ public shutdown() { - registry?.unregister(this); this.workspace.free(); } diff --git a/npm/js-api/tests/__snapshots__/lintContent.test.ts.snap b/npm/js-api/tests/__snapshots__/lintContent.test.ts.snap index 8b7654d1598..20595d2d030 100644 --- a/npm/js-api/tests/__snapshots__/lintContent.test.ts.snap +++ b/npm/js-api/tests/__snapshots__/lintContent.test.ts.snap @@ -30,11 +30,7 @@ exports[`Rome WebAssembly lintContent > should lint content > lint diagnostics 1 }, { "Frame": { - "path": { - "File": { - "FileId": 0, - }, - }, + "path": null, "source_code": null, "span": [ 6, @@ -125,10 +121,7 @@ exports[`Rome WebAssembly lintContent > should lint content > lint diagnostics 1 "location": { "path": { "File": { - "PathAndId": { - "file_id": 0, - "path": "example.js", - }, + "Path": "example.js", }, }, "source_code": null, diff --git a/npm/js-api/tsconfig.json b/npm/js-api/tsconfig.json index 5578b9bb277..b495ae47b1b 100644 --- a/npm/js-api/tsconfig.json +++ b/npm/js-api/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["ES2020", "ESNext.WeakRef"], "module": "commonjs", /* Specify what module code is generated. */ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ "declarationMap": true, /* Create sourcemaps for d.ts files. */