Skip to content

Commit

Permalink
test: fix classDiagramGrammer unit test
Browse files Browse the repository at this point in the history
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: 221640a
  • Loading branch information
aloisklink committed May 7, 2023
1 parent 7f9ebcf commit a1e64c2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down

0 comments on commit a1e64c2

Please sign in to comment.