• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import type { LinterOptions } from '../lib/LinterOptions';
17
18export enum TestMode {
19  DEFAULT,
20  AUTOFIX,
21  ARKTS2,
22  MIGRATE
23}
24
25export interface TestModeProperties {
26  resultFileExt: string;
27  mode: TestMode;
28  modeOpts: LinterOptions;
29}
30
31export const DEFAULT_MODE_PROPERTIES: TestModeProperties = {
32  resultFileExt: '.json',
33  mode: TestMode.DEFAULT,
34  modeOpts: {}
35};
36const AUTOFIX_MODE_PROPERTIES: TestModeProperties = {
37  resultFileExt: '.autofix.json',
38  mode: TestMode.AUTOFIX,
39  modeOpts: {
40    enableAutofix: true
41  }
42};
43const ARKTS2_MODE_PROPERTIES: TestModeProperties = {
44  resultFileExt: '.arkts2.json',
45  mode: TestMode.ARKTS2,
46  modeOpts: {
47    arkts2: true
48  }
49};
50const MIGRATE_MODE_PROPERTIES: TestModeProperties = {
51  resultFileExt: '.migrate.json',
52  mode: TestMode.MIGRATE,
53  modeOpts: {
54    migratorMode: true,
55    noMigrationBackupFile: true
56  }
57};
58
59export const testModePropsMap: Map<string, TestModeProperties> = new Map([
60  ['default', DEFAULT_MODE_PROPERTIES],
61  ['autofix', AUTOFIX_MODE_PROPERTIES],
62  ['arkts2', ARKTS2_MODE_PROPERTIES],
63  ['migrate', MIGRATE_MODE_PROPERTIES]
64]);
65