restore path calculation for grammar test

This commit is contained in:
Justin Greywolf
2023-05-04 09:15:21 -07:00
parent 06fdb95389
commit 7e240dac22

View File

@@ -4,12 +4,12 @@ import { LALRGenerator } from 'jison';
import path from 'path'; import path from 'path';
const getAbsolutePath = (relativePath: string) => { const getAbsolutePath = (relativePath: string) => {
return new URL(path.join(__dirname, relativePath)).pathname; return new URL(path.join(path.dirname(import.meta.url), relativePath)).pathname;
}; };
describe('class diagram grammar', function () { describe('class diagram grammar', function () {
it('should have no conflicts', async function () { it('should have no conflicts', async function () {
const grammarSource = await readFile(getAbsolutePath('parser/classDiagram.jison'), 'utf8'); const grammarSource = await readFile(getAbsolutePath('./parser/classDiagram.jison'), 'utf8');
const grammarParser = new LALRGenerator(grammarSource, {}); const grammarParser = new LALRGenerator(grammarSource, {});
expect(grammarParser.conflicts).toBe(0); expect(grammarParser.conflicts).toBe(0);
}); });