Tidy up unit test suite file structure (#1910)
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"args": [
|
||||
"--projects",
|
||||
"test"
|
||||
"test/unit-tests"
|
||||
],
|
||||
"stopOnEntry": false,
|
||||
"sourceMaps": true,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -167,7 +167,7 @@ const config: Config = {
|
||||
"^.+\\.tsx?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: "<rootDir>/tsconfig.json",
|
||||
tsconfig: "<rootDir>/../tsconfig.json",
|
||||
},
|
||||
],
|
||||
node_modules: [
|
||||
@@ -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);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { formatDate } from "../../src/pure/date";
|
||||
import { formatDate } from "../../../src/pure/date";
|
||||
|
||||
describe("Date", () => {
|
||||
it("should return a formatted date", () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DisposableObject } from "../../src/pure/disposable-object";
|
||||
import { DisposableObject } from "../../../src/pure/disposable-object";
|
||||
|
||||
describe("DisposableObject and DisposeHandler", () => {
|
||||
const disposable1 = {
|
||||
@@ -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 () => {
|
||||
@@ -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 () => {
|
||||
@@ -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", () => {
|
||||
@@ -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);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { formatDecimal } from "../../src/pure/number";
|
||||
import { formatDecimal } from "../../../src/pure/number";
|
||||
|
||||
describe("Number", () => {
|
||||
it("should return a formatted decimal", () => {
|
||||
@@ -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 () => {
|
||||
@@ -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", () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { pluralize } from "../../src/pure/word";
|
||||
import { pluralize } from "../../../src/pure/word";
|
||||
|
||||
describe("word helpers", () => {
|
||||
describe("pluralize", () => {
|
||||
Reference in New Issue
Block a user