Skip to content

Commit

Permalink
feat: use 'testplane.config.[tj]s' config name
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Sep 30, 2024
1 parent 4603173 commit 2bff575
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/constants/packageManagement.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
export const PACKAGE_JSON = "package.json";

export const CONFIG_NAMES = {
TESTPLANE_NEW_TS: "testplane.config.ts",
TESTPLANE_NEW_CTS: "testplane.config.cts",
TESTPLANE_NEW_JS: "testplane.config.js",
TESTPLANE_NEW_CJS: "testplane.config.cjs",
TESTPLANE_TS: ".testplane.conf.ts",
TESTPLANE_JS: ".testplane.conf.js",
HERMIONE_TS: ".hermione.conf.ts", // drop after testplane@2
HERMIONE_JS: ".hermione.conf.js", // drop after testplane@2
HERMIONE_TS: ".hermione.conf.ts", // drop after testplane@9
HERMIONE_JS: ".hermione.conf.js", // drop after testplane@9
} as const;

export const DEFAULT_PM = "npm";
Expand Down
2 changes: 1 addition & 1 deletion src/fsUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("fsUtils", () => {

await fsUtils.writeTestplaneConfig("/", config);

expect(fsPromises.writeFile).toBeCalledWith(`/.testplane.conf.${ext}`, expectedConfigWritten);
expect(fsPromises.writeFile).toBeCalledWith(`/testplane.config.${ext}`, expectedConfigWritten);
};

it("js config", async () => {
Expand Down
9 changes: 8 additions & 1 deletion src/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ describe("package", () => {
});

describe("initApp", () => {
[".testplane.conf.ts", ".testplane.conf.js", ".hermione.conf.ts", ".hermione.conf.js"].forEach(configName => {
[
".testplane.conf.ts",
".testplane.conf.js",
".hermione.conf.ts",
".hermione.conf.js",
"testplane.config.ts",
"testplane.config.cjs",
].forEach(configName => {
it(`should throw an error, if ${configName} exists`, async () => {
const dirPath = "/dir/path";
jest.mocked(fsUtils.exists).mockImplementation(file =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/configTemplates/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfigTemplate } from ".";
import { CONFIG_NAMES } from "../../constants/packageManagement";

export const jsTemplate: ConfigTemplate = {
fileName: CONFIG_NAMES.TESTPLANE_JS,
fileName: CONFIG_NAMES.TESTPLANE_NEW_JS,
language: "js",
quote: "'",
getImportModule: (importName, moduleName) => `const ${importName} = require('${moduleName}');`,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/configTemplates/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ConfigTemplate } from ".";
import { CONFIG_NAMES } from "../../constants/packageManagement";

export const tsTemplate: ConfigTemplate = {
fileName: CONFIG_NAMES.TESTPLANE_TS,
fileName: CONFIG_NAMES.TESTPLANE_NEW_TS,
language: "ts",
quote: '"',
getImportModule: (importName, moduleName) => `import ${importName} from "${moduleName}";`,
Expand Down

0 comments on commit 2bff575

Please sign in to comment.