Remove tests.folderName and tests.mockFolderName project config options
MODIFY
packages/@romejs/core/common/constants.ts
packages/@romejs/core/common/constants.ts
@@ -29,3 +29,6 @@ export const VERSION = String(packageJson.version);
export const SOCKET_PATH = TEMP_PATH.append(`rome-${VERSION}.sock`);
export const CLI_SOCKET_PATH = TEMP_PATH.append(`rome-wait-${VERSION}.sock`);
+
+export const TEST_FOLDER_NAME = '__rtests__';
+export const MOCKS_FOLDER_NAME = '__rmocks__';

MODIFY
packages/@romejs/core/master/commands/test.ts
packages/@romejs/core/master/commands/test.ts
@@ -15,13 +15,14 @@ import {commandCategories} from '../../commands';
import Bundler from '../bundler/Bundler';
import {AbsoluteFilePath} from '@romejs/path';
import {JS_EXTENSIONS} from '../../common/fileHandlers';
+import {TEST_FOLDER_NAME} from '@romejs/core/common/constants';
-function isTestFile(path: AbsoluteFilePath, testFolder: string): boolean {
+function isTestFile(path: AbsoluteFilePath): boolean {
const parts = path.getSegments();
for (const part of parts) {
// Don't include files/directories that are prefixed with an underscore
- if (part[0] === '_' && part !== testFolder) {
+ if (part[0] === '_' && part !== TEST_FOLDER_NAME) {
return false;
}
@@ -33,7 +34,7 @@ function isTestFile(path: AbsoluteFilePath, testFolder: string): boolean {
// Make sure we're actually a test file
for (const part of parts) {
- if (part === testFolder) {
+ if (part === TEST_FOLDER_NAME) {
return true;
}
}
@@ -78,9 +79,7 @@ export default createMasterCommand({
const matches = master.memoryFs.glob(loc, {extensions: JS_EXTENSIONS});
for (const path of matches) {
- const project = master.projectManager.assertProjectExisting(path);
-
- if (isTestFile(path, project.config.tests.folderName)) {
+ if (isTestFile(path)) {
files.push(path);
}
}

MODIFY
packages/@romejs/core/master/fs/MemoryFileSystem.ts
packages/@romejs/core/master/fs/MemoryFileSystem.ts
@@ -30,6 +30,10 @@ import {
getFileHandler,
getFileHandlerExtensions,
} from '../../common/fileHandlers';
+import {
+ TEST_FOLDER_NAME,
+ MOCKS_FOLDER_NAME,
+} from '@romejs/core/common/constants';
const DEFAULT_DENYLIST = ['.hg', '.git'];
@@ -716,8 +720,8 @@ export default class MemoryFileSystem {
const project = this.master.projectManager.findProjectExisting(path);
if (project !== undefined) {
if (
- parts.includes(project.config.tests.folderName) ||
- parts.includes(project.config.tests.mocksFolderName)
+ parts.includes(TEST_FOLDER_NAME) ||
+ parts.includes(MOCKS_FOLDER_NAME)
) {
return false;
}

MODIFY
packages/@romejs/core/master/fs/Resolver.ts
packages/@romejs/core/master/fs/Resolver.ts
@@ -22,6 +22,7 @@ import {DiagnosticPointer, PartialDiagnosticAdvice} from '@romejs/diagnostics';
import {IMPLICIT_JS_EXTENSIONS} from '../../common/fileHandlers';
import {writeFile} from '@romejs/fs';
import https = require('https');
+import {MOCKS_FOLDER_NAME} from '@romejs/core/common/constants';
function request(
url: string,
@@ -624,7 +625,7 @@ export default class Resolver {
const moduleName = query.source.assertRelative();
for (const dir of parentDirectories) {
- const mocksDir = dir.append(project.config.tests.mocksFolderName);
+ const mocksDir = dir.append(MOCKS_FOLDER_NAME);
// No use resolving against a directory that doesn't exist
if (!this.master.memoryFs.exists(mocksDir)) {

MODIFY
packages/@romejs/core/master/linter/CompilerLinter.ts
packages/@romejs/core/master/linter/CompilerLinter.ts
@@ -80,7 +80,7 @@ export default class CompilerLinter {
printer.addDiagnostic({
category: '',
message:
- 'Files excluded from linting as it\'s not enabled. Add `lint: {"enabled": true}`',
+ "Files excluded from linting as it's not enabled for this project. Run `rome config enable lint` to enable it.",
...consumer.getDiagnosticPointer(),
});
} else {

MODIFY
packages/@romejs/project/load.ts
packages/@romejs/project/load.ts
@@ -310,10 +310,6 @@ export function normalizeProjectConfig(
config.tests.enabled = testing.get('enabled').asBoolean();
}
- if (testing.has('folderName')) {
- config.tests.folderName = testing.get('folderName').asString();
- }
-
if (testing.has('ignore')) {
config.tests.ignore = arrayOfPatterns(testing.get('ignore'));
}

MODIFY
packages/@romejs/project/types.ts
packages/@romejs/project/types.ts
@@ -70,8 +70,6 @@ export type ProjectConfigObjects = {
tests: {
enabled: boolean;
- folderName: string;
- mocksFolderName: string;
ignore: PathPatterns;
};
@@ -232,8 +230,6 @@ export const DEFAULT_PROJECT_CONFIG: ProjectConfig = {
tests: {
enabled: false,
- folderName: '__rtests__',
- mocksFolderName: '__rmocks__',
ignore: [],
},

Remove tests.folderName and tests.mockFolderName project config options