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": [
|
"args": [
|
||||||
"--projects",
|
"--projects",
|
||||||
"test"
|
"test/unit-tests"
|
||||||
],
|
],
|
||||||
"stopOnEntry": false,
|
"stopOnEntry": false,
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
projects: [
|
projects: [
|
||||||
"<rootDir>/src/view",
|
"<rootDir>/src/view",
|
||||||
"<rootDir>/test",
|
"<rootDir>/test/unit-tests",
|
||||||
"<rootDir>/src/vscode-tests/cli-integration",
|
"<rootDir>/src/vscode-tests/cli-integration",
|
||||||
"<rootDir>/src/vscode-tests/no-workspace",
|
"<rootDir>/src/vscode-tests/no-workspace",
|
||||||
"<rootDir>/src/vscode-tests/minimal-workspace",
|
"<rootDir>/src/vscode-tests/minimal-workspace",
|
||||||
|
|||||||
@@ -1285,7 +1285,7 @@
|
|||||||
"watch:webpack": "gulp watchView",
|
"watch:webpack": "gulp watchView",
|
||||||
"watch:files": "gulp watchTestData",
|
"watch:files": "gulp watchTestData",
|
||||||
"test": "npm-run-all -p test:*",
|
"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",
|
"test:view": "jest --projects src/view",
|
||||||
"integration": "npm-run-all integration:*",
|
"integration": "npm-run-all integration:*",
|
||||||
"integration:no-workspace": "jest --projects src/vscode-tests/no-workspace",
|
"integration:no-workspace": "jest --projects src/vscode-tests/no-workspace",
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ const config: Config = {
|
|||||||
"^.+\\.tsx?$": [
|
"^.+\\.tsx?$": [
|
||||||
"ts-jest",
|
"ts-jest",
|
||||||
{
|
{
|
||||||
tsconfig: "<rootDir>/tsconfig.json",
|
tsconfig: "<rootDir>/../tsconfig.json",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
node_modules: [
|
node_modules: [
|
||||||
@@ -40,7 +40,7 @@ describe("log scanners", () => {
|
|||||||
scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => 50));
|
scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => 50));
|
||||||
const summaryPath = join(
|
const summaryPath = join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"evaluator-log-summaries/bad-join-order.jsonl",
|
"data/evaluator-log-summaries/bad-join-order.jsonl",
|
||||||
);
|
);
|
||||||
const problemReporter = new TestProblemReporter();
|
const problemReporter = new TestProblemReporter();
|
||||||
await scanners.scanLog(summaryPath, problemReporter);
|
await scanners.scanLog(summaryPath, problemReporter);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { formatDate } from "../../src/pure/date";
|
import { formatDate } from "../../../src/pure/date";
|
||||||
|
|
||||||
describe("Date", () => {
|
describe("Date", () => {
|
||||||
it("should return a formatted 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", () => {
|
describe("DisposableObject and DisposeHandler", () => {
|
||||||
const disposable1 = {
|
const disposable1 = {
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { join, dirname } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
gatherQlFiles,
|
gatherQlFiles,
|
||||||
getDirectoryNamesInsidePath,
|
getDirectoryNamesInsidePath,
|
||||||
} from "../../src/pure/files";
|
} from "../../../src/pure/files";
|
||||||
|
|
||||||
describe("files", () => {
|
describe("files", () => {
|
||||||
const dataDir = join(dirname(__dirname), "data");
|
const dataDir = join(__dirname, "../../data");
|
||||||
const data2Dir = join(dirname(__dirname), "data2");
|
const data2Dir = join(__dirname, "../../data2");
|
||||||
|
|
||||||
describe("gatherQlFiles", () => {
|
describe("gatherQlFiles", () => {
|
||||||
it("should find one file", async () => {
|
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", () => {
|
describe("helpers-pure", () => {
|
||||||
it("should filter asynchronously", async () => {
|
it("should filter asynchronously", async () => {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
tryGetRemoteLocation,
|
tryGetRemoteLocation,
|
||||||
tryGetResolvableLocation,
|
tryGetResolvableLocation,
|
||||||
} from "../../src/pure/bqrs-utils";
|
} from "../../../src/pure/bqrs-utils";
|
||||||
|
|
||||||
describe("processing string locations", () => {
|
describe("processing string locations", () => {
|
||||||
it("should detect Windows whole-file locations", () => {
|
it("should detect Windows whole-file locations", () => {
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { join } from "path";
|
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("Evaluator log summary tests", () => {
|
||||||
describe("for a valid summary text", () => {
|
describe("for a valid summary text", () => {
|
||||||
it("should return only valid EvalLogData objects", async () => {
|
it("should return only valid EvalLogData objects", async () => {
|
||||||
const validSummaryPath = join(
|
const validSummaryPath = join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"evaluator-log-summaries/valid-summary.jsonl",
|
"../data/evaluator-log-summaries/valid-summary.jsonl",
|
||||||
);
|
);
|
||||||
const logDataItems = await parseViewerData(validSummaryPath);
|
const logDataItems = await parseViewerData(validSummaryPath);
|
||||||
expect(logDataItems).toBeDefined();
|
expect(logDataItems).toBeDefined();
|
||||||
@@ -29,7 +29,7 @@ describe("Evaluator log summary tests", () => {
|
|||||||
it("should not parse a summary header object", async () => {
|
it("should not parse a summary header object", async () => {
|
||||||
const invalidHeaderPath = join(
|
const invalidHeaderPath = join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"evaluator-log-summaries/invalid-header.jsonl",
|
"../data/evaluator-log-summaries/invalid-header.jsonl",
|
||||||
);
|
);
|
||||||
const logDataItems = await parseViewerData(invalidHeaderPath);
|
const logDataItems = await parseViewerData(invalidHeaderPath);
|
||||||
expect(logDataItems.length).toBe(0);
|
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 () => {
|
it("should not parse a log event missing RA or millis fields", async () => {
|
||||||
const invalidSummaryPath = join(
|
const invalidSummaryPath = join(
|
||||||
__dirname,
|
__dirname,
|
||||||
"evaluator-log-summaries/invalid-summary.jsonl",
|
"../data/evaluator-log-summaries/invalid-summary.jsonl",
|
||||||
);
|
);
|
||||||
const logDataItems = await parseViewerData(invalidSummaryPath);
|
const logDataItems = await parseViewerData(invalidSummaryPath);
|
||||||
expect(logDataItems.length).toBe(0);
|
expect(logDataItems.length).toBe(0);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { formatDecimal } from "../../src/pure/number";
|
import { formatDecimal } from "../../../src/pure/number";
|
||||||
|
|
||||||
describe("Number", () => {
|
describe("Number", () => {
|
||||||
it("should return a formatted decimal", () => {
|
it("should return a formatted decimal", () => {
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
parseSarifLocation,
|
parseSarifLocation,
|
||||||
parseSarifPlainTextMessage,
|
parseSarifPlainTextMessage,
|
||||||
unescapeSarifText,
|
unescapeSarifText,
|
||||||
} from "../../src/pure/sarif-utils";
|
} from "../../../src/pure/sarif-utils";
|
||||||
|
|
||||||
describe("parsing sarif", () => {
|
describe("parsing sarif", () => {
|
||||||
it("should be able to parse a simple message from the spec", async () => {
|
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", () => {
|
describe("Time", () => {
|
||||||
it("should return a humanized unit", () => {
|
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("word helpers", () => {
|
||||||
describe("pluralize", () => {
|
describe("pluralize", () => {
|
||||||
Reference in New Issue
Block a user