test: fix classDiagramGrammer unit test

The classDiagramGrammer.spec.ts unit test had some bad filepath
manipulation that fails on UNIX platforms.

Instead, we can use the recommended method from the Node.JS
documentation, see https://nodejs.org/api/esm.html#importmetaurl.

Fixes: 221640aa25
This commit is contained in:
Alois Klink 2023-05-07 18:05:43 +01:00
parent 7f9ebcf2c6
commit a1e64c2102
1 changed files with 2 additions and 2 deletions

View File

@ -1,10 +1,10 @@
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
// @ts-ignore - no types
import { LALRGenerator } from 'jison';
import path from 'path';
const getAbsolutePath = (relativePath: string) => {
return new URL(path.join(__dirname, relativePath)).pathname;
return fileURLToPath(new URL(relativePath, import.meta.url));
};
describe('class diagram grammar', function () {