Skip to content

Commit

Permalink
test: get tests running again
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Sep 6, 2023
1 parent 20cebf6 commit c8e067e
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/helpers/location.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { isLocationEqual, locationToString, positionToString, rangeToString } from './location';
import { isLocationEqual, locationToString, positionToString, rangeToString } from './location.js';

describe('positionToString', () => {
it.each([
Expand Down
6 changes: 3 additions & 3 deletions tests/helpers/testChecks.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { describe, expect, it } from 'vitest';
import { CloseWithoutOpenError, OpenWithoutCloseError } from './testRanges';
import { CLOSE, OPEN } from './testMarker';
import { CloseWithoutOpenError, OpenWithoutCloseError } from './testRanges.js';
import { CLOSE, OPEN } from './testMarker.js';
import {
FewerRangesThanCommentsError,
findTestChecks,
MoreRangesThanCommentsError,
NoCommentsError,
} from './testChecks';
} from './testChecks.js';
import { Range } from 'vscode-languageserver';

const uri = 'file:///test.sdstest';
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/testChecks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Location, Range } from 'vscode-languageserver';
import { findTestComments } from './testComments';
import { findTestRanges, FindTestRangesError } from './testRanges';
import { findTestComments } from './testComments.js';
import { findTestRanges, FindTestRangesError } from './testRanges.js';
import { Result } from 'true-myth';

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/testComments.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { findTestComments } from './testComments';
import { findTestComments } from './testComments.js';

describe('findTestComments', () => {
it.each([
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/testRanges.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { CloseWithoutOpenError, findTestRanges, OpenWithoutCloseError } from './testRanges';
import { CloseWithoutOpenError, findTestRanges, OpenWithoutCloseError } from './testRanges.js';
import { Position, Range } from 'vscode-languageserver';
import { CLOSE, OPEN } from './testMarker';
import { CLOSE, OPEN } from './testMarker.js';

describe('findTestRanges', () => {
it('should find all ranges enclosed by test markers in order of opening markers', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/testRanges.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Result } from 'true-myth';
import { Range, Position } from 'vscode-languageserver';
import { CLOSE, OPEN } from './testMarker';
import { positionToString } from './location';
import { CLOSE, OPEN } from './testMarker.js';
import { positionToString } from './location.js';

/**
* Finds test ranges, i.e. parts of the program delimited by opening and closing test markers. They are sorted by the
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/testResources.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { listTestResources } from './testResources';
import { listTestResources } from './testResources.js';

describe('listTestResources', () => {
it('should yield all Safe-DS files in a directory that are not skipped', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/testResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PIPELINE_FILE_EXTENSION,
STUB_FILE_EXTENSION,
TEST_FILE_EXTENSION,
} from '../../src/language/constant/fileExtensions';
} from '../../src/language/constant/fileExtensions.js';

const resourcesPath = path.join(__dirname, '..', 'resources');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources';
import { listTestResources, resolvePathRelativeToResources } from '../../helpers/testResources';
import path from 'path';
import fs from 'fs';
import { validationHelper } from 'langium/test';
import { Diagnostic } from 'vscode-languageserver-types';
import { createSafeDsServices } from '../../src/language/safe-ds-module';
import { createSafeDsServices } from '../../../src/language/safe-ds-module';
import { EmptyFileSystem } from 'langium';

const services = createSafeDsServices(EmptyFileSystem).SafeDs;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createSafeDsServices } from '../../src/language/safe-ds-module';
import { createSafeDsServices } from '../../../src/language/safe-ds-module';
import { clearDocuments, expectFormatting } from 'langium/test';
import { describe, it } from 'vitest';
import { EmptyFileSystem } from 'langium';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources';
import { listTestResources, resolvePathRelativeToResources } from '../../helpers/testResources';
import path from 'path';
import fs from 'fs';
import { findTestComments } from '../helpers/testComments';
import { NoCommentsError } from '../helpers/testChecks';
import { findTestComments } from '../../helpers/testComments';
import { NoCommentsError } from '../../helpers/testChecks';

export const createGrammarTests = (): GrammarTest[] => {
return listTestResources('grammar').map((pathRelativeToResources): GrammarTest => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it } from 'vitest';
import { createSafeDsServices } from '../../src/language/safe-ds-module';
import { createSafeDsServices } from '../../../src/language/safe-ds-module';
import { AssertionError } from 'assert';
import { NodeFileSystem } from 'langium/node';
import { createGrammarTests } from './creator';
Expand All @@ -17,7 +17,7 @@ describe('grammar', () => {
// Get the actual syntax errors
const { diagnostics } = await validationHelper(services)(test.code);
const syntaxErrors = diagnostics.filter(
(d) => d.severity === 1 && (d.code === 'lexing-error' || d.code === 'parsing-error'),
(d) => d.severity === 1 && (d.data.code === 'lexing-error' || d.data.code === 'parsing-error'),
);

// Expected syntax errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { listTestResources, resolvePathRelativeToResources } from '../helpers/testResources';
import { listTestResources, resolvePathRelativeToResources } from '../../helpers/testResources';
import { group } from 'radash';
import path from 'path';
import fs from 'fs';
import { findTestChecks } from '../helpers/testChecks';
import { findTestChecks } from '../../helpers/testChecks';
import { Location } from 'vscode-languageserver';
import { URI } from 'vscode-uri';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, it } from 'vitest';
import { createSafeDsServices } from '../../src/language/safe-ds-module';
import { createSafeDsServices } from '../../../src/language/safe-ds-module';
import { URI } from 'vscode-uri';
import { NodeFileSystem } from 'langium/node';
import { isRangeEqual } from 'langium/test';
import { AssertionError } from 'assert';
import { isLocationEqual, locationToString } from '../helpers/location';
import { isLocationEqual, locationToString } from '../../helpers/location';
import { createScopingTests, ExpectedReference } from './creator';
import { LangiumDocument, Reference } from 'langium';
import { Location } from 'vscode-languageserver';
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default defineConfig({
include: ['src'],
exclude: ['**/generated'],
},
exclude: ['out'],
exclude: ['node_modules', 'out'],
},
});

0 comments on commit c8e067e

Please sign in to comment.