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": [ "args": [
"--projects", "--projects",
"test" "test/unit-tests"
], ],
"stopOnEntry": false, "stopOnEntry": false,
"sourceMaps": true, "sourceMaps": true,

View File

@@ -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",

View File

@@ -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",

View File

@@ -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: [

View File

@@ -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);

View File

@@ -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", () => {

View File

@@ -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 = {

View File

@@ -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 () => {

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", () => { describe("helpers-pure", () => {
it("should filter asynchronously", async () => { it("should filter asynchronously", async () => {

View File

@@ -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", () => {

View File

@@ -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);

View File

@@ -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", () => {

View File

@@ -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 () => {

View File

@@ -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", () => {

View File

@@ -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", () => {