Tidy up unit test suite file structure (#1910)

This commit is contained in:
Charis Kyriakou
2022-12-23 14:23:55 +00:00
committed by GitHub
parent 24a7348fc2
commit 40a7dd04fb
52 changed files with 21 additions and 21 deletions

2
.vscode/launch.json vendored
View File

@@ -38,7 +38,7 @@
},
"args": [
"--projects",
"test"
"test/unit-tests"
],
"stopOnEntry": false,
"sourceMaps": true,

View File

@@ -7,7 +7,7 @@
module.exports = {
projects: [
"<rootDir>/src/view",
"<rootDir>/test",
"<rootDir>/test/unit-tests",
"<rootDir>/src/vscode-tests/cli-integration",
"<rootDir>/src/vscode-tests/no-workspace",
"<rootDir>/src/vscode-tests/minimal-workspace",

View File

@@ -1285,7 +1285,7 @@
"watch:webpack": "gulp watchView",
"watch:files": "gulp watchTestData",
"test": "npm-run-all -p test:*",
"test:unit": "cross-env TZ=UTC LANG=en-US jest --projects test",
"test:unit": "cross-env TZ=UTC LANG=en-US jest --projects test/unit-tests",
"test:view": "jest --projects src/view",
"integration": "npm-run-all integration:*",
"integration:no-workspace": "jest --projects src/vscode-tests/no-workspace",

View File

@@ -167,7 +167,7 @@ const config: Config = {
"^.+\\.tsx?$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.json",
tsconfig: "<rootDir>/../tsconfig.json",
},
],
node_modules: [

View File

@@ -40,7 +40,7 @@ describe("log scanners", () => {
scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => 50));
const summaryPath = join(
__dirname,
"evaluator-log-summaries/bad-join-order.jsonl",
"data/evaluator-log-summaries/bad-join-order.jsonl",
);
const problemReporter = new TestProblemReporter();
await scanners.scanLog(summaryPath, problemReporter);

View File

@@ -1,4 +1,4 @@
import { formatDate } from "../../src/pure/date";
import { formatDate } from "../../../src/pure/date";
describe("Date", () => {
it("should return a formatted date", () => {

View File

@@ -1,4 +1,4 @@
import { DisposableObject } from "../../src/pure/disposable-object";
import { DisposableObject } from "../../../src/pure/disposable-object";
describe("DisposableObject and DisposeHandler", () => {
const disposable1 = {

View File

@@ -1,13 +1,13 @@
import { join, dirname } from "path";
import { join } from "path";
import {
gatherQlFiles,
getDirectoryNamesInsidePath,
} from "../../src/pure/files";
} from "../../../src/pure/files";
describe("files", () => {
const dataDir = join(dirname(__dirname), "data");
const data2Dir = join(dirname(__dirname), "data2");
const dataDir = join(__dirname, "../../data");
const data2Dir = join(__dirname, "../../data2");
describe("gatherQlFiles", () => {
it("should find one file", async () => {

View File

@@ -1,4 +1,4 @@
import { asyncFilter, getErrorMessage } from "../../src/pure/helpers-pure";
import { asyncFilter, getErrorMessage } from "../../../src/pure/helpers-pure";
describe("helpers-pure", () => {
it("should filter asynchronously", async () => {

View File

@@ -1,7 +1,7 @@
import {
tryGetRemoteLocation,
tryGetResolvableLocation,
} from "../../src/pure/bqrs-utils";
} from "../../../src/pure/bqrs-utils";
describe("processing string locations", () => {
it("should detect Windows whole-file locations", () => {

View File

@@ -1,13 +1,13 @@
import { join } from "path";
import { parseViewerData } from "../../src/pure/log-summary-parser";
import { parseViewerData } from "../../../src/pure/log-summary-parser";
describe("Evaluator log summary tests", () => {
describe("for a valid summary text", () => {
it("should return only valid EvalLogData objects", async () => {
const validSummaryPath = join(
__dirname,
"evaluator-log-summaries/valid-summary.jsonl",
"../data/evaluator-log-summaries/valid-summary.jsonl",
);
const logDataItems = await parseViewerData(validSummaryPath);
expect(logDataItems).toBeDefined();
@@ -29,7 +29,7 @@ describe("Evaluator log summary tests", () => {
it("should not parse a summary header object", async () => {
const invalidHeaderPath = join(
__dirname,
"evaluator-log-summaries/invalid-header.jsonl",
"../data/evaluator-log-summaries/invalid-header.jsonl",
);
const logDataItems = await parseViewerData(invalidHeaderPath);
expect(logDataItems.length).toBe(0);
@@ -38,7 +38,7 @@ describe("Evaluator log summary tests", () => {
it("should not parse a log event missing RA or millis fields", async () => {
const invalidSummaryPath = join(
__dirname,
"evaluator-log-summaries/invalid-summary.jsonl",
"../data/evaluator-log-summaries/invalid-summary.jsonl",
);
const logDataItems = await parseViewerData(invalidSummaryPath);
expect(logDataItems.length).toBe(0);

View File

@@ -1,4 +1,4 @@
import { formatDecimal } from "../../src/pure/number";
import { formatDecimal } from "../../../src/pure/number";
describe("Number", () => {
it("should return a formatted decimal", () => {

View File

@@ -5,7 +5,7 @@ import {
parseSarifLocation,
parseSarifPlainTextMessage,
unescapeSarifText,
} from "../../src/pure/sarif-utils";
} from "../../../src/pure/sarif-utils";
describe("parsing sarif", () => {
it("should be able to parse a simple message from the spec", async () => {

View File

@@ -1,4 +1,4 @@
import { humanizeRelativeTime, humanizeUnit } from "../../src/pure/time";
import { humanizeRelativeTime, humanizeUnit } from "../../../src/pure/time";
describe("Time", () => {
it("should return a humanized unit", () => {

View File

@@ -1,4 +1,4 @@
import { pluralize } from "../../src/pure/word";
import { pluralize } from "../../../src/pure/word";
describe("word helpers", () => {
describe("pluralize", () => {