Skip to content

Commit

Permalink
fix: use unified tests dir
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Feb 14, 2024
1 parent 730f45b commit f584ec3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/fsUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from "lodash";
import fs from "fs";
import path from "path";
import { defaultHermioneTestsDir } from "./constants/defaultHermioneConfig";
import type { HermioneConfig } from "./types/hermioneConfig";

const createDirectory = (path: string): Promise<string | undefined> => fs.promises.mkdir(path, { recursive: true });
Expand Down Expand Up @@ -100,7 +101,7 @@ export const writeHermioneConfig = async (dirPath: string, hermioneConfig: Hermi
};

export const writeTest = async (dirPath: string, testName: string, testContent: string): Promise<void> => {
const testDirPath = path.resolve(dirPath, "hermione-tests");
const testDirPath = path.resolve(dirPath, defaultHermioneTestsDir);
const testPath = path.resolve(testDirPath, testName);

try {
Expand Down
3 changes: 2 additions & 1 deletion src/pluginsConfig/hermione-headless-chrome.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from "lodash";
import { HERMIONE_HEADLESS_CHROME } from "../constants/plugins";
import { defaultHermioneTestsDir } from "../constants/defaultHermioneConfig";
import type { HermioneConfig } from "../types/hermioneConfig";

export default {
Expand All @@ -21,7 +22,7 @@ export default {
sets: {
desktop: {
browsers: [browserId],
files: ["tests/**/*.hermione.js"],
files: [`${defaultHermioneTestsDir}/**/*.hermione.js`],
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/pluginsConfig/hermione-safari-commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import inquirer, { DistinctQuestion } from "inquirer";
import _ from "lodash";
import { HERMIONE_SAFARI_COMMANDS } from "../constants/plugins";
import { defaultHermioneTestsDir } from "../constants/defaultHermioneConfig";
import type { HermioneConfig } from "../types/hermioneConfig";

type SafariCommand =
Expand Down Expand Up @@ -44,7 +45,7 @@ export default {
sets: {
"touch-phone": {
browsers: [browserId],
files: ["tests/**/*.hermione.js"],
files: [`${defaultHermioneTestsDir}/**/*.hermione.js`],
},
},
browsers: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe("utils", () => {
sets: {
"touch-phone": {
browsers: ["chrome-phone"],
files: ["tests/**/*.hermione.js"],
files: ["hermione-tests/**/*.hermione.js"],
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import path from "path";
import { Colors } from "./colors";
import { pluginSuffixes } from "../constants/packageManagement";
import fsUtils from "../fsUtils";
import { defaultHermioneTestsDir } from "../constants/defaultHermioneConfig";
import type { ConfigNote } from "../plugins";
import type { ToolArgv } from "../types/toolArgv";
import type { ArgvOpts, HandleGeneralPromptsCallback } from "../types/toolOpts";
import type { HermioneConfig, Language } from "../types";
import { defaultHermioneTestsDir } from "../constants/defaultHermioneConfig";

export const optsFromArgv = (argv: ToolArgv): ArgvOpts => {
if (!argv["_"].length) {
Expand Down Expand Up @@ -62,7 +62,7 @@ export const baseGeneralPromptsHandler: HandleGeneralPromptsCallback = async (he
sets: {
"touch-phone": {
browsers: [browserId],
files: ["tests/**/*.hermione.js"],
files: [`${defaultHermioneTestsDir}/**/*.hermione.js`],
},
},
browsers: {
Expand Down

0 comments on commit f584ec3

Please sign in to comment.