Migrate unit/integration tests to Vitest with Vite
As part of transition to Vue 3.0 and Vite (#230), this commit facilitates the shift towards building rest of the application using Vite. By doing so, it eliminates reliance on outdated Electron building system that offered limited control, blocking desktop builds (#233). Changes include: - Introduce Vite with Vue 2.0 plugin for test execution. - Remove `mocha`, `chai` and other related dependencies. - Adjust test to Vitest syntax. - Revise and update `tests.md` to document the changes. - Add `@modyfi/vite-plugin-yaml` plugin to be able to use yaml file depended logic on test files, replacing previous webpack behavior. - Fix failing tests that are revealed by Vitest due to unhandled errors and lack of assertments. - Remove the test that depends on Vue CLI populating `process.env`. - Use `jsdom` for unit test environment, adding it to dependency to `package.json` as project now depends on it and it was not specified even though `package-lock.json` included it.
This commit is contained in:
3
tests/README.md
Normal file
3
tests/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# tests
|
||||
|
||||
See [`tests.md`](./../docs/tests.md)
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { afterEach } from 'vitest';
|
||||
import { enableAutoDestroy } from '@vue/test-utils';
|
||||
|
||||
enableAutoDestroy(afterEach);
|
||||
|
||||
@@ -3,7 +3,6 @@ module.exports = {
|
||||
'cypress',
|
||||
],
|
||||
env: {
|
||||
mocha: true,
|
||||
'cypress/globals': true,
|
||||
},
|
||||
rules: {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
|
||||
describe('ApplicationParser', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
import { IApplication } from '@/domain/IApplication';
|
||||
import { IUrlStatus } from './StatusChecker/IUrlStatus';
|
||||
@@ -29,7 +28,7 @@ describe('collections', () => {
|
||||
// assert
|
||||
const deadUrls = results.filter((r) => r.code !== 200);
|
||||
expect(deadUrls).to.have.lengthOf(0, printUrls(deadUrls));
|
||||
}).timeout(testTimeoutInMs);
|
||||
}, testTimeoutInMs);
|
||||
});
|
||||
|
||||
function collectUniqueUrls(app: IApplication): string[] {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { createRenderer } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/Documentation/MarkdownRenderer';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ApplicationFactory, ApplicationGetterType } from '@/application/ApplicationFactory';
|
||||
import { ApplicationStub } from '@tests/unit/shared/Stubs/ApplicationStub';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { scrambledEqual, sequenceEqual } from '@/application/Common/Array';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { ComparerTestScenario } from './Array.ComparerTestScenario';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line max-classes-per-file
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {
|
||||
describe, it, afterEach, expect,
|
||||
} from 'vitest';
|
||||
import { CustomError, Environment } from '@/application/Common/CustomError';
|
||||
|
||||
describe('CustomError', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import {
|
||||
getEnumNames, getEnumValues, createEnumParser, assertInRange,
|
||||
} from '@/application/Common/Enum';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { EnumType } from '@/application/Common/Enum';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { ScriptingLanguageFactory } from '@/application/Common/ScriptingLanguage/ScriptingLanguageFactory';
|
||||
import { EnumRangeTestRunner } from '@tests/unit/application/Common/EnumRangeTestRunner';
|
||||
@@ -58,8 +57,12 @@ describe('ScriptingLanguageFactory', () => {
|
||||
const sut = new ScriptingLanguageConcrete();
|
||||
const runner = new ScriptingLanguageFactoryTestRunner();
|
||||
// act
|
||||
sut.registerGetter(ScriptingLanguage.batchfile, () => 1);
|
||||
sut.registerGetter(ScriptingLanguage.batchfile, () => ScriptingLanguage.batchfile);
|
||||
sut.registerGetter(ScriptingLanguage.shellscript, () => ScriptingLanguage.shellscript);
|
||||
// assert
|
||||
runner.testCreateMethod(sut);
|
||||
runner
|
||||
.expectValue(ScriptingLanguage.shellscript, ScriptingLanguage.shellscript)
|
||||
.expectValue(ScriptingLanguage.batchfile, ScriptingLanguage.batchfile)
|
||||
.testCreateMethod(sut);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,29 +1,45 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IScriptingLanguageFactory } from '@/application/Common/ScriptingLanguage/IScriptingLanguageFactory';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { EnumRangeTestRunner } from '@tests/unit/application/Common/EnumRangeTestRunner';
|
||||
|
||||
export class ScriptingLanguageFactoryTestRunner<T> {
|
||||
private expectedTypes = new Map<ScriptingLanguage, T>();
|
||||
type Constructible<T = object> = new (...args: unknown[]) => T;
|
||||
|
||||
public expect(language: ScriptingLanguage, resultType: T) {
|
||||
this.expectedTypes.set(language, resultType);
|
||||
export class ScriptingLanguageFactoryTestRunner<T> {
|
||||
private expectedLanguageTypes = new Map<ScriptingLanguage, Constructible<T>>();
|
||||
|
||||
private expectedValues = new Map<ScriptingLanguage, T>();
|
||||
|
||||
public expectInstance(language: ScriptingLanguage, resultType: Constructible<T>) {
|
||||
this.expectedLanguageTypes.set(language, resultType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public expectValue(language: ScriptingLanguage, resultType: T) {
|
||||
this.expectedValues.set(language, resultType);
|
||||
return this;
|
||||
}
|
||||
|
||||
public testCreateMethod(sut: IScriptingLanguageFactory<T>) {
|
||||
if (!sut) { throw new Error('missing sut'); }
|
||||
testLanguageValidation(sut);
|
||||
testExpectedInstanceTypes(sut, this.expectedTypes);
|
||||
if (this.expectedLanguageTypes.size) {
|
||||
testExpectedInstanceTypes(sut, this.expectedLanguageTypes);
|
||||
}
|
||||
if (this.expectedValues.size) {
|
||||
testExpectedValues(sut, this.expectedValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function testExpectedInstanceTypes<T>(
|
||||
sut: IScriptingLanguageFactory<T>,
|
||||
expectedTypes: Map<ScriptingLanguage, T>,
|
||||
expectedTypes: Map<ScriptingLanguage, Constructible<T>>,
|
||||
) {
|
||||
describe('create returns expected instances', () => {
|
||||
if (!expectedTypes?.size) {
|
||||
throw new Error('No expected types provided.');
|
||||
}
|
||||
describe('`create` creates expected instances', () => {
|
||||
// arrange
|
||||
for (const language of expectedTypes.keys()) {
|
||||
it(ScriptingLanguage[language], () => {
|
||||
@@ -37,8 +53,29 @@ function testExpectedInstanceTypes<T>(
|
||||
});
|
||||
}
|
||||
|
||||
function testExpectedValues<T>(
|
||||
sut: IScriptingLanguageFactory<T>,
|
||||
expectedValues: Map<ScriptingLanguage, T>,
|
||||
) {
|
||||
if (!expectedValues?.size) {
|
||||
throw new Error('No expected values provided.');
|
||||
}
|
||||
describe('`create` creates expected values', () => {
|
||||
// arrange
|
||||
for (const language of expectedValues.keys()) {
|
||||
it(ScriptingLanguage[language], () => {
|
||||
// act
|
||||
const expected = expectedValues.get(language);
|
||||
const result = sut.create(language);
|
||||
// assert
|
||||
expect(result).to.equal(expected);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function testLanguageValidation<T>(sut: IScriptingLanguageFactory<T>) {
|
||||
describe('validates language', () => {
|
||||
describe('`create` validates language selection', () => {
|
||||
// arrange
|
||||
const validValue = ScriptingLanguage.batchfile;
|
||||
// act
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ApplicationContext } from '@/application/Context/ApplicationContext';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { ICategoryCollectionState } from '@/application/Context/State/ICategoryCollectionState';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
||||
import { buildContext } from '@/application/Context/ApplicationContextFactory';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { UserSelection } from '@/application/Context/State/Selection/UserSelection';
|
||||
import { ApplicationCode } from '@/application/Context/State/Code/ApplicationCode';
|
||||
import { CategoryCollectionState } from '@/application/Context/State/CategoryCollectionState';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { UserSelection } from '@/application/Context/State/Selection/UserSelection';
|
||||
import { ApplicationCode } from '@/application/Context/State/Code/ApplicationCode';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CodeChangedEvent } from '@/application/Context/State/Code/Event/CodeChangedEvent';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
import { ICodePosition } from '@/application/Context/State/Code/Position/ICodePosition';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CodeBuilder } from '@/application/Context/State/Code/Generation/CodeBuilder';
|
||||
|
||||
describe('CodeBuilder', () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { describe } from 'vitest';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { ShellBuilder } from '@/application/Context/State/Code/Generation/Languages/ShellBuilder';
|
||||
import { BatchBuilder } from '@/application/Context/State/Code/Generation/Languages/BatchBuilder';
|
||||
@@ -7,7 +8,7 @@ import { ScriptingLanguageFactoryTestRunner } from '@tests/unit/application/Comm
|
||||
describe('CodeBuilderFactory', () => {
|
||||
const sut = new CodeBuilderFactory();
|
||||
const runner = new ScriptingLanguageFactoryTestRunner()
|
||||
.expect(ScriptingLanguage.shellscript, ShellBuilder)
|
||||
.expect(ScriptingLanguage.batchfile, BatchBuilder);
|
||||
.expectInstance(ScriptingLanguage.shellscript, ShellBuilder)
|
||||
.expectInstance(ScriptingLanguage.batchfile, BatchBuilder);
|
||||
runner.testCreateMethod(sut);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { BatchBuilder } from '@/application/Context/State/Code/Generation/Languages/BatchBuilder';
|
||||
|
||||
describe('BatchBuilder', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ShellBuilder } from '@/application/Context/State/Code/Generation/Languages/ShellBuilder';
|
||||
|
||||
describe('ShellBuilder', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { UserScriptGenerator } from '@/application/Context/State/Code/Generation/UserScriptGenerator';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
import { ICodeBuilderFactory } from '@/application/Context/State/Code/Generation/ICodeBuilderFactory';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CodePosition } from '@/application/Context/State/Code/Position/CodePosition';
|
||||
|
||||
describe('CodePosition', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FilterChange } from '@/application/Context/State/Filter/Event/FilterChange';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { FilterResultStub } from '@tests/unit/shared/Stubs/FilterResultStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FilterResult } from '@/application/Context/State/Filter/FilterResult';
|
||||
import { CategoryStub } from '@tests/unit/shared/Stubs/CategoryStub';
|
||||
import { ScriptStub } from '@tests/unit/shared/Stubs/ScriptStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IFilterResult } from '@/application/Context/State/Filter/IFilterResult';
|
||||
import { UserFilter } from '@/application/Context/State/Filter/UserFilter';
|
||||
import { CategoryStub } from '@tests/unit/shared/Stubs/CategoryStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ScriptStub } from '@tests/unit/shared/Stubs/ScriptStub';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
import { UserSelection } from '@/application/Context/State/Selection/UserSelection';
|
||||
import { CategoryStub } from '@tests/unit/shared/Stubs/CategoryStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { expect } from 'chai';
|
||||
import 'mocha';
|
||||
import { it, expect } from 'vitest';
|
||||
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
|
||||
import { CategoryCollectionStub } from '@tests/unit/shared/Stubs/CategoryCollectionStub';
|
||||
import { CategoryStub } from '@tests/unit/shared/Stubs/CategoryStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { BrowserOsDetector } from '@/application/Environment/BrowserOs/BrowserOsDetector';
|
||||
import { itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IBrowserOsDetector } from '@/application/Environment/BrowserOs/IBrowserOsDetector';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { Environment, IEnvironmentVariables } from '@/application/Environment/Environment';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { CollectionData } from '@/application/collections/';
|
||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
||||
import { VueAppEnvironment, parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
||||
import { CategoryCollectionParserType, parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
import WindowsData from '@/application/collections/windows.yaml';
|
||||
import MacOsData from '@/application/collections/macos.yaml';
|
||||
@@ -28,10 +28,11 @@ describe('ApplicationParser', () => {
|
||||
const parser = new CategoryCollectionParserSpy()
|
||||
.setUpReturnValue(data, expected)
|
||||
.mockParser();
|
||||
const env = getProcessEnvironmentStub();
|
||||
const collections = [data];
|
||||
const sut = new ApplicationParserBuilder()
|
||||
.withCategoryCollectionParser(parser)
|
||||
.withCollectionsData([data]);
|
||||
// act
|
||||
const app = parseApplication(parser, env, collections);
|
||||
const app = sut.parseApplication();
|
||||
// assert
|
||||
const actual = app.getCollection(os);
|
||||
expect(expected).to.equal(actual);
|
||||
@@ -44,20 +45,10 @@ describe('ApplicationParser', () => {
|
||||
const expected = parseProjectInformation(env);
|
||||
const parserSpy = new CategoryCollectionParserSpy();
|
||||
const parserMock = parserSpy.mockParser();
|
||||
const sut = new ApplicationParserBuilder()
|
||||
.withCategoryCollectionParser(parserMock);
|
||||
// act
|
||||
const app = parseApplication(parserMock, env);
|
||||
// assert
|
||||
expect(expected).to.deep.equal(app.info);
|
||||
expect(parserSpy.arguments.map((arg) => arg.info).every((info) => info === expected));
|
||||
});
|
||||
it('defaults to process.env', () => {
|
||||
// arrange
|
||||
const { env } = process;
|
||||
const expected = parseProjectInformation(env);
|
||||
const parserSpy = new CategoryCollectionParserSpy();
|
||||
const parserMock = parserSpy.mockParser();
|
||||
// act
|
||||
const app = parseApplication(parserMock);
|
||||
const app = sut.parseApplication();
|
||||
// assert
|
||||
expect(expected).to.deep.equal(app.info);
|
||||
expect(parserSpy.arguments.map((arg) => arg.info).every((info) => info === expected));
|
||||
@@ -87,14 +78,15 @@ describe('ApplicationParser', () => {
|
||||
// act
|
||||
for (const testCase of testCases) {
|
||||
it(testCase.name, () => {
|
||||
const env = getProcessEnvironmentStub();
|
||||
let parserSpy = new CategoryCollectionParserSpy();
|
||||
for (let i = 0; i < testCase.input.length; i++) {
|
||||
parserSpy = parserSpy.setUpReturnValue(testCase.input[i], testCase.output[i]);
|
||||
}
|
||||
const parserMock = parserSpy.mockParser();
|
||||
const sut = new ApplicationParserBuilder()
|
||||
.withCategoryCollectionParser(parserSpy.mockParser())
|
||||
.withCollectionsData(testCase.input);
|
||||
// act
|
||||
const app = parseApplication(parserMock, env, testCase.input);
|
||||
const app = sut.parseApplication();
|
||||
// assert
|
||||
expect(app.collections).to.deep.equal(testCase.output);
|
||||
});
|
||||
@@ -104,9 +96,11 @@ describe('ApplicationParser', () => {
|
||||
// arrange
|
||||
const expected = [WindowsData, MacOsData, LinuxData];
|
||||
const parserSpy = new CategoryCollectionParserSpy();
|
||||
const parserMock = parserSpy.mockParser();
|
||||
const sut = new ApplicationParserBuilder()
|
||||
.withCollectionsData(undefined)
|
||||
.withCategoryCollectionParser(parserSpy.mockParser());
|
||||
// act
|
||||
parseApplication(parserMock);
|
||||
sut.parseApplication();
|
||||
// assert
|
||||
const actual = parserSpy.arguments.map((args) => args.data);
|
||||
expect(actual).to.deep.equal(expected);
|
||||
@@ -127,10 +121,10 @@ describe('ApplicationParser', () => {
|
||||
];
|
||||
for (const testCase of testCases) {
|
||||
it(testCase.name, () => {
|
||||
const parserMock = new CategoryCollectionParserSpy().mockParser();
|
||||
const env = getProcessEnvironmentStub();
|
||||
const sut = new ApplicationParserBuilder()
|
||||
.withCollectionsData(testCase.value);
|
||||
// act
|
||||
const act = () => parseApplication(parserMock, env, testCase.value);
|
||||
const act = () => sut.parseApplication();
|
||||
// assert
|
||||
expect(act).to.throw(testCase.expectedError);
|
||||
});
|
||||
@@ -140,6 +134,42 @@ describe('ApplicationParser', () => {
|
||||
});
|
||||
});
|
||||
|
||||
class ApplicationParserBuilder {
|
||||
private categoryCollectionParser: CategoryCollectionParserType = new CategoryCollectionParserSpy()
|
||||
.mockParser();
|
||||
|
||||
private environment: VueAppEnvironment = getProcessEnvironmentStub();
|
||||
|
||||
private collectionsData: CollectionData[] = [new CollectionDataStub()];
|
||||
|
||||
public withCategoryCollectionParser(
|
||||
categoryCollectionParser: CategoryCollectionParserType,
|
||||
): this {
|
||||
this.categoryCollectionParser = categoryCollectionParser;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withEnvironment(
|
||||
environment: VueAppEnvironment,
|
||||
): this {
|
||||
this.environment = environment;
|
||||
return this;
|
||||
}
|
||||
|
||||
public withCollectionsData(collectionsData: CollectionData[]): this {
|
||||
this.collectionsData = collectionsData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public parseApplication(): ReturnType<typeof parseApplication> {
|
||||
return parseApplication(
|
||||
this.categoryCollectionParser,
|
||||
this.environment,
|
||||
this.collectionsData,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryCollectionParserSpy {
|
||||
public arguments = new Array<{
|
||||
data: CollectionData,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IEntity } from '@/infrastructure/Entity/IEntity';
|
||||
import { parseCategoryCollection } from '@/application/Parser/CategoryCollectionParser';
|
||||
import { parseCategory } from '@/application/Parser/CategoryParser';
|
||||
import { parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
||||
import { ScriptingDefinitionParser } from '@/application/Parser/ScriptingDefinition/ScriptingDefinitionParser';
|
||||
@@ -80,7 +78,7 @@ describe('CategoryCollectionParser', () => {
|
||||
it('parses scripting definition as expected', () => {
|
||||
// arrange
|
||||
const collection = new CollectionDataStub();
|
||||
const information = parseProjectInformation(process.env);
|
||||
const information = new ProjectInformationStub();
|
||||
const expected = new ScriptingDefinitionParser()
|
||||
.parse(collection.scripting, information);
|
||||
// act
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { CategoryData, CategoryOrScriptData } from '@/application/collections/';
|
||||
import { CategoryFactoryType, parseCategory } from '@/application/Parser/CategoryParser';
|
||||
import { parseScript } from '@/application/Parser/Script/ScriptParser';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { DocumentableData } from '@/application/collections/';
|
||||
import { parseDocs } from '@/application/Parser/DocumentationParser';
|
||||
import { itEachAbsentObjectValue, itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { INodeDataErrorContext, NodeDataError } from '@/application/Parser/NodeValidation/NodeDataError';
|
||||
import { NodeDataErrorContextStub } from '@tests/unit/shared/Stubs/NodeDataErrorContextStub';
|
||||
import { NodeType } from '@/application/Parser/NodeValidation/NodeType';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { NodeDataError } from '@/application/Parser/NodeValidation/NodeDataError';
|
||||
import { NodeValidator } from '@/application/Parser/NodeValidation/NodeValidator';
|
||||
import { expectThrowsError } from '@tests/unit/shared/Assertions/ExpectThrowsError';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe, it } from 'vitest';
|
||||
import { NodeDataError, INodeDataErrorContext } from '@/application/Parser/NodeValidation/NodeDataError';
|
||||
import { NodeData } from '@/application/Parser/NodeValidation/NodeData';
|
||||
import { AbsentObjectTestCases, AbsentStringTestCases, itEachAbsentTestCase } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { VueAppEnvironmentKeys, parseProjectInformation } from '@/application/Parser/ProjectInformationParser';
|
||||
import { getProcessEnvironmentStub } from '@tests/unit/shared/Stubs/ProcessEnvironmentStub';
|
||||
import { IProjectInformation } from '@/domain/IProjectInformation';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ISyntaxFactory } from '@/application/Parser/Script/Validation/Syntax/ISyntaxFactory';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { CategoryCollectionParseContext } from '@/application/Parser/Script/CategoryCollectionParseContext';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
import { ExpressionEvaluator, Expression } from '@/application/Parser/Script/Compiler/Expressions/Expression/Expression';
|
||||
import { IReadOnlyFunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgumentCollection';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionEvaluationContext, IExpressionEvaluationContext } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionEvaluationContext';
|
||||
import { IReadOnlyFunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgumentCollection';
|
||||
import { IPipelineCompiler } from '@/application/Parser/Script/Compiler/Expressions/Pipes/IPipelineCompiler';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
|
||||
describe('ExpressionPosition', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/ExpressionsCompiler';
|
||||
import { IExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/IExpressionParser';
|
||||
import { ExpressionStub } from '@tests/unit/shared/Stubs/ExpressionStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IExpression } from '@/application/Parser/Script/Compiler/Expressions/Expression/IExpression';
|
||||
import { IExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/IExpressionParser';
|
||||
import { CompositeExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/CompositeExpressionParser';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'mocha';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionRegexBuilder } from '@/application/Parser/Script/Compiler/Expressions/Parser/Regex/ExpressionRegexBuilder';
|
||||
|
||||
describe('ExpressionRegexBuilder', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ExpressionEvaluator } from '@/application/Parser/Script/Compiler/Expressions/Expression/Expression';
|
||||
import { IPrimitiveExpression, RegexParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/Regex/RegexParser';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { EscapeDoubleQuotes } from '@/application/Parser/Script/Compiler/Expressions/Pipes/PipeDefinitions/EscapeDoubleQuotes';
|
||||
import { AbsentStringTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { runPipeTests } from './PipeTestRunner';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { InlinePowerShell } from '@/application/Parser/Script/Compiler/Expressions/Pipes/PipeDefinitions/InlinePowerShell';
|
||||
import { IPipeTestCase, runPipeTests } from './PipeTestRunner';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { it, expect } from 'vitest';
|
||||
import { IPipe } from '@/application/Parser/Script/Compiler/Expressions/Pipes/IPipe';
|
||||
|
||||
export interface IPipeTestCase {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { PipeFactory } from '@/application/Parser/Script/Compiler/Expressions/Pipes/PipeFactory';
|
||||
import { PipeStub } from '@tests/unit/shared/Stubs/PipeStub';
|
||||
import { AbsentStringTestCases, itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { PipelineCompiler } from '@/application/Parser/Script/Compiler/Expressions/Pipes/PipelineCompiler';
|
||||
import { IPipelineCompiler } from '@/application/Parser/Script/Compiler/Expressions/Pipes/IPipelineCompiler';
|
||||
import { IPipeFactory } from '@/application/Parser/Script/Compiler/Expressions/Pipes/PipeFactory';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { ParameterSubstitutionParser } from '@/application/Parser/Script/Compiler/Expressions/SyntaxParsers/ParameterSubstitutionParser';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
import { SyntaxParserTestsRunner } from './SyntaxParserTestsRunner';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { it, expect } from 'vitest';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
import { IExpressionParser } from '@/application/Parser/Script/Compiler/Expressions/Parser/IExpressionParser';
|
||||
import { FunctionCallArgumentCollectionStub } from '@tests/unit/shared/Stubs/FunctionCallArgumentCollectionStub';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Expressions/Expression/ExpressionPosition';
|
||||
import { WithParser } from '@/application/Parser/Script/Compiler/Expressions/SyntaxParsers/WithParser';
|
||||
import { AbsentStringTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, expect } from 'vitest';
|
||||
import { FunctionCallArgument } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgument';
|
||||
import { itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { testParameterName } from '../../../ParameterNameTestRunner';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/FunctionCallArgumentCollection';
|
||||
import { FunctionCallArgumentStub } from '@tests/unit/shared/Stubs/FunctionCallArgumentStub';
|
||||
import { itEachAbsentObjectValue, itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { FunctionCallParametersData } from '@/application/collections/';
|
||||
import { FunctionCallCompiler } from '@/application/Parser/Script/Compiler/Function/Call/Compiler/FunctionCallCompiler';
|
||||
import { ISharedFunctionCollection } from '@/application/Parser/Script/Compiler/Function/ISharedFunctionCollection';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FunctionCall } from '@/application/Parser/Script/Compiler/Function/Call/FunctionCall';
|
||||
import { IReadOnlyFunctionCallArgumentCollection } from '@/application/Parser/Script/Compiler/Function/Call/Argument/IFunctionCallArgumentCollection';
|
||||
import { FunctionCallArgumentCollectionStub } from '@tests/unit/shared/Stubs/FunctionCallArgumentCollectionStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseFunctionCalls } from '@/application/Parser/Script/Compiler/Function/Call/FunctionCallParser';
|
||||
import { FunctionCallDataStub } from '@tests/unit/shared/Stubs/FunctionCallDataStub';
|
||||
import { itEachAbsentObjectValue, itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FunctionParameter } from '@/application/Parser/Script/Compiler/Function/Parameter/FunctionParameter';
|
||||
import { testParameterName } from '../../ParameterNameTestRunner';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { FunctionParameterCollection } from '@/application/Parser/Script/Compiler/Function/Parameter/FunctionParameterCollection';
|
||||
import { FunctionParameterStub } from '@tests/unit/shared/Stubs/FunctionParameterStub';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IReadOnlyFunctionParameterCollection } from '@/application/Parser/Script/Compiler/Function/Parameter/IFunctionParameterCollection';
|
||||
import { FunctionParameterCollectionStub } from '@tests/unit/shared/Stubs/FunctionParameterCollectionStub';
|
||||
import { createCallerFunction, createFunctionWithInlineCode } from '@/application/Parser/Script/Compiler/Function/SharedFunction';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SharedFunctionCollection } from '@/application/Parser/Script/Compiler/Function/SharedFunctionCollection';
|
||||
import { SharedFunctionStub } from '@tests/unit/shared/Stubs/SharedFunctionStub';
|
||||
import { FunctionBodyType } from '@/application/Parser/Script/Compiler/Function/ISharedFunction';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { FunctionData } from '@/application/collections/';
|
||||
import { ISharedFunction } from '@/application/Parser/Script/Compiler/Function/ISharedFunction';
|
||||
import { SharedFunctionsParser } from '@/application/Parser/Script/Compiler/Function/SharedFunctionsParser';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { AbsentStringTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
export function testParameterName(action: (parameterName: string) => string) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { FunctionData } from '@/application/collections/';
|
||||
import { ScriptCode } from '@/domain/ScriptCode';
|
||||
import { ScriptCompiler } from '@/application/Parser/Script/Compiler/ScriptCompiler';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import type { ScriptData } from '@/application/collections/';
|
||||
import { parseScript, ScriptFactoryType } from '@/application/Parser/Script/ScriptParser';
|
||||
import { parseDocs } from '@/application/Parser/DocumentationParser';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CodeValidator } from '@/application/Parser/Script/Validation/CodeValidator';
|
||||
import { CodeValidationRuleStub } from '@tests/unit/shared/Stubs/CodeValidationRuleStub';
|
||||
import { itEachAbsentCollectionValue, itEachAbsentStringValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { it, expect } from 'vitest';
|
||||
import { ICodeValidationRule, IInvalidCodeLine } from '@/application/Parser/Script/Validation/ICodeValidationRule';
|
||||
import { ICodeLine } from '@/application/Parser/Script/Validation/ICodeLine';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, expect } from 'vitest';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { NoDuplicatedLines } from '@/application/Parser/Script/Validation/Rules/NoDuplicatedLines';
|
||||
import { LanguageSyntaxStub } from '@tests/unit/shared/Stubs/LanguageSyntaxStub';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { describe } from 'vitest';
|
||||
import { NoEmptyLines } from '@/application/Parser/Script/Validation/Rules/NoEmptyLines';
|
||||
import { testCodeValidationRule } from './CodeValidationRuleTestRunner';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ShellScriptSyntax } from '@/application/Parser/Script/Validation/Syntax/ShellScriptSyntax';
|
||||
import { ILanguageSyntax } from '@/application/Parser/Script/Validation/Syntax/ILanguageSyntax';
|
||||
import { BatchFileSyntax } from '@/application/Parser/Script/Validation/Syntax/BatchFileSyntax';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { SyntaxFactory } from '@/application/Parser/Script/Validation/Syntax/SyntaxFactory';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { ShellScriptSyntax } from '@/application/Parser/Script/Validation/Syntax/ShellScriptSyntax';
|
||||
@@ -8,7 +8,7 @@ import { BatchFileSyntax } from '@/application/Parser/Script/Validation/Syntax/B
|
||||
describe('SyntaxFactory', () => {
|
||||
const sut = new SyntaxFactory();
|
||||
const runner = new ScriptingLanguageFactoryTestRunner()
|
||||
.expect(ScriptingLanguage.shellscript, ShellScriptSyntax)
|
||||
.expect(ScriptingLanguage.batchfile, BatchFileSyntax);
|
||||
.expectInstance(ScriptingLanguage.shellscript, ShellScriptSyntax)
|
||||
.expectInstance(ScriptingLanguage.batchfile, BatchFileSyntax);
|
||||
runner.testCreateMethod(sut);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CodeSubstituter } from '@/application/Parser/ScriptingDefinition/CodeSubstituter';
|
||||
import { IExpressionsCompiler } from '@/application/Parser/Script/Compiler/Expressions/IExpressionsCompiler';
|
||||
import { ProjectInformationStub } from '@tests/unit/shared/Stubs/ProjectInformationStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { ScriptingDefinitionParser } from '@/application/Parser/ScriptingDefinition/ScriptingDefinitionParser';
|
||||
import { IEnumParser } from '@/application/Common/Enum';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'mocha';
|
||||
import { resolve, join, basename } from 'path';
|
||||
import { readdirSync, readFileSync } from 'fs';
|
||||
import { expect } from 'chai';
|
||||
import { resolve, join, basename } from 'path';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
/*
|
||||
A common mistake when working with yaml files to forget mentioning that a value should
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Application } from '@/domain/Application';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { CategoryCollectionStub } from '@tests/unit/shared/Stubs/CategoryCollectionStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Category } from '@/domain/Category';
|
||||
import { CategoryStub } from '@tests/unit/shared/Stubs/CategoryStub';
|
||||
import { ScriptStub } from '@tests/unit/shared/Stubs/ScriptStub';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ICategory } from '@/domain/ICategory';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ProjectInformation } from '@/domain/ProjectInformation';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { EnumRangeTestRunner } from '@tests/unit/application/Common/EnumRangeTestRunner';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { getEnumValues } from '@/application/Common/Enum';
|
||||
import { Script } from '@/domain/Script';
|
||||
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ScriptCode } from '@/domain/ScriptCode';
|
||||
import { AbsentStringTestCases } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ScriptingDefinition } from '@/domain/ScriptingDefinition';
|
||||
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
|
||||
import { getEnumValues } from '@/application/Common/Enum';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { Version } from '@/domain/Version';
|
||||
|
||||
describe('Version', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { EnvironmentStub } from '@tests/unit/shared/Stubs/EnvironmentStub';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { CodeRunner } from '@/infrastructure/CodeRunner';
|
||||
@@ -193,7 +192,7 @@ function getNodeJsMocks() {
|
||||
}
|
||||
|
||||
function mockOs(commandHistory: NodeJsCommand[]) {
|
||||
let tmpDir: string;
|
||||
let tmpDir = '/stub-temp-dir/';
|
||||
return {
|
||||
setupTmpdir: (value: string): void => {
|
||||
tmpDir = value;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {
|
||||
describe, it, expect, beforeEach,
|
||||
} from 'vitest';
|
||||
import { EventHandler, IEventSource, IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
||||
import { EventSource } from '@/infrastructure/Events/EventSource';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { EventSubscriptionCollection } from '@/infrastructure/Events/EventSubscriptionCollection';
|
||||
import { IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { NumericEntityStub } from '@tests/unit/shared/Stubs/NumericEntityStub';
|
||||
import { InMemoryRepository } from '@/infrastructure/Repository/InMemoryRepository';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import {
|
||||
describe, it, expect, beforeEach,
|
||||
} from 'vitest';
|
||||
import { AsyncLazy } from '@/infrastructure/Threading/AsyncLazy';
|
||||
import { sleep } from '@/infrastructure/Threading/AsyncSleep';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { sleep, SchedulerType, SchedulerCallbackType } from '@/infrastructure/Threading/AsyncSleep';
|
||||
|
||||
describe('AsyncSleep', () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { IInstructionsBuilderData, InstructionsBuilder, InstructionStepBuilderType } from '@/presentation/components/Code/CodeButtons/Instructions/Data/InstructionsBuilder';
|
||||
import { itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'mocha';
|
||||
import { describe } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { MacOsInstructionsBuilder } from '@/presentation/components/Code/CodeButtons/Instructions/Data/MacOsInstructionsBuilder';
|
||||
import { runOsSpecificInstructionBuilderTests } from './OsSpecificInstructionBuilderTestRunner';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { expect } from 'chai';
|
||||
import { it, expect } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { InstructionsBuilder } from '@/presentation/components/Code/CodeButtons/Instructions/Data/InstructionsBuilder';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { getInstructions, hasInstructions } from '@/presentation/components/Code/CodeButtons/Instructions/InstructionListDataFactory';
|
||||
import { getEnumValues } from '@/application/Common/Enum';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SelectionType, SelectionTypeHandler } from '@/presentation/components/Scripts/Menu/Selector/SelectionTypeHandler';
|
||||
import { scrambledEqual } from '@/application/Common/Array';
|
||||
import { RecommendationLevel } from '@/domain/RecommendationLevel';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { NonCollapsing, hasDirective } from '@/presentation/components/Scripts/View/Cards/NonCollapsingDirective';
|
||||
|
||||
const expectedAttributeName = 'data-interaction-does-not-collapse';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import {
|
||||
getScriptNodeId, getScriptId, getCategoryNodeId, getCategoryId, parseSingleCategory,
|
||||
parseAllCategories,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ILiquorTreeExistingNode } from 'liquor-tree';
|
||||
import { NodeType, INodeContent } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/Node/INodeContent';
|
||||
import { NodePredicateFilter } from '@/presentation/components/Scripts/View/ScriptsTree/SelectableTree/LiquorTree/NodeWrapper/NodePredicateFilter';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user