Skip to content

Commit 5bc7271

Browse files
authored
chore: remove all deprecated things (#6669)
* chore: remove all deprecated things * chore: update tests
1 parent f176cb9 commit 5bc7271

48 files changed

Lines changed: 132 additions & 1631 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/cli/src/_test_/merge-flags.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,6 @@ describe('mergeFlags', () => {
262262
});
263263
});
264264

265-
describe('e2eTests (--e2e)', () => {
266-
it('sets e2eTests from --e2e flag', () => {
267-
const config: Config = {};
268-
const flags = createFlags({ e2e: true });
269-
270-
const result = mergeFlags(config, flags);
271-
272-
expect(result.e2eTests).toBe(true);
273-
});
274-
});
275-
276265
describe('maxConcurrentWorkers (--maxWorkers)', () => {
277266
it('sets maxConcurrentWorkers from --maxWorkers flag', () => {
278267
const config: Config = {};

packages/cli/src/_test_/parse-flags.spec.ts

Lines changed: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
BOOLEAN_CLI_FLAGS,
77
BOOLEAN_STRING_CLI_FLAGS,
88
BooleanStringCLIFlag,
9-
ConfigFlags,
109
NUMBER_CLI_FLAGS,
1110
STRING_ARRAY_CLI_FLAGS,
1211
STRING_CLI_FLAGS,
@@ -298,43 +297,6 @@ describe('parseFlags', () => {
298297
expect(flags.knownArgs).toEqual(['--config', '/my-config.js']);
299298
});
300299
});
301-
302-
describe('Jest aliases', () => {
303-
it.each([
304-
['w', 'maxWorkers', '4'],
305-
['t', 'testNamePattern', 'testname'],
306-
])('should support the string Jest alias %p for %p', (alias, fullArgument, value) => {
307-
const flags = parseFlags([`-${alias}`, value]);
308-
expect(flags.knownArgs).toEqual([`--${fullArgument}`, value]);
309-
expect(flags.unknownArgs).toHaveLength(0);
310-
});
311-
312-
it.each([
313-
['w', 'maxWorkers', '4'],
314-
['t', 'testNamePattern', 'testname'],
315-
])(
316-
'should support the string Jest alias %p for %p in an AliasEqualsArg',
317-
(alias, fullArgument, value) => {
318-
const flags = parseFlags([`-${alias}=${value}`]);
319-
expect(flags.knownArgs).toEqual([`--${fullArgument}`, value]);
320-
expect(flags.unknownArgs).toHaveLength(0);
321-
},
322-
);
323-
324-
it.each<[string, keyof ConfigFlags]>([
325-
['b', 'bail'],
326-
['e', 'expand'],
327-
['o', 'onlyChanged'],
328-
['f', 'onlyFailures'],
329-
['i', 'runInBand'],
330-
['u', 'updateSnapshot'],
331-
])('should support the boolean Jest alias %p for %p', (alias, fullArgument) => {
332-
const flags = parseFlags([`-${alias}`]);
333-
expect(flags.knownArgs).toEqual([`--${fullArgument}`]);
334-
expect(flags[fullArgument]).toBe(true);
335-
expect(flags.unknownArgs).toHaveLength(0);
336-
});
337-
});
338300
});
339301

340302
it('should parse many', () => {
@@ -361,7 +323,7 @@ describe('parseFlags', () => {
361323
});
362324

363325
describe.each(STRING_ARRAY_CLI_FLAGS)(
364-
'should parse string flag %s',
326+
'should parse string array flag %s',
365327
(cliArg: StringArrayCLIFlag) => {
366328
it(`should parse single value: "--${cliArg} test-value"`, () => {
367329
const flags = parseFlags([`--${cliArg}`, 'test-value']);
@@ -452,17 +414,9 @@ describe('parseFlags', () => {
452414
describe('error reporting', () => {
453415
it('should throw if you pass no argument to a string flag', () => {
454416
expect(() => {
455-
parseFlags(['--cacheDirectory', '--someOtherFlag']);
456-
}).toThrow(
457-
'when parsing CLI flag "--cacheDirectory": expected a string argument but received nothing',
458-
);
459-
});
460-
461-
it('should throw if you pass no argument to a string array flag', () => {
462-
expect(() => {
463-
parseFlags(['--reporters', '--someOtherFlag']);
417+
parseFlags(['--config', '--someOtherFlag']);
464418
}).toThrow(
465-
'when parsing CLI flag "--reporters": expected a string argument but received nothing',
419+
'when parsing CLI flag "--config": expected a string argument but received nothing',
466420
);
467421
});
468422

packages/cli/src/config-flags.ts

Lines changed: 5 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export const BOOLEAN_CLI_FLAGS = [
1515
'dev',
1616
'devtools',
1717
'docs',
18-
// @deprecated - integrated testing will be removed in Stencil v5. See https://github.com/stenciljs/core/issues/6584.
19-
'e2e',
2018
'esm',
2119
'help',
2220
'log',
@@ -26,81 +24,18 @@ export const BOOLEAN_CLI_FLAGS = [
2624
'prod',
2725
'profile',
2826
'serviceWorker',
29-
// @deprecated - screenshot testing will be removed in Stencil v5. See https://github.com/stenciljs/core/issues/6584.
30-
'screenshot',
3127
'serve',
3228
'skipNodeCheck',
33-
// @deprecated - integrated testing will be removed in Stencil v5. See https://github.com/stenciljs/core/issues/6584.
34-
'spec',
3529
'ssr',
36-
// @deprecated - screenshot testing will be removed in Stencil v5. See https://github.com/stenciljs/core/issues/6584.
37-
'updateScreenshot',
3830
'verbose',
3931
'version',
4032
'watch',
41-
42-
// @deprecated - all JEST CLI options below are only used by integrated testing, which will be removed in Stencil v5.
43-
// See https://github.com/stenciljs/core/issues/6584.
44-
// JEST CLI OPTIONS
45-
'all',
46-
'automock',
47-
'bail',
48-
// 'cache', Stencil already supports this argument
49-
'changedFilesWithAncestor',
50-
// 'ci', Stencil already supports this argument
51-
'clearCache',
52-
'clearMocks',
53-
'collectCoverage',
54-
'color',
55-
'colors',
56-
'coverage',
57-
// 'debug', Stencil already supports this argument
58-
'detectLeaks',
59-
'detectOpenHandles',
60-
'errorOnDeprecated',
61-
'expand',
62-
'findRelatedTests',
63-
'forceExit',
64-
'init',
65-
'injectGlobals',
66-
'json',
67-
'lastCommit',
68-
'listTests',
69-
'logHeapUsage',
70-
'noStackTrace',
71-
'notify',
72-
'onlyChanged',
73-
'onlyFailures',
74-
'passWithNoTests',
75-
'resetMocks',
76-
'resetModules',
77-
'restoreMocks',
78-
'runInBand',
79-
'runTestsByPath',
80-
'showConfig',
81-
'silent',
82-
'skipFilter',
83-
'testLocationInResults',
84-
'updateSnapshot',
85-
'useStderr',
86-
// 'verbose', Stencil already supports this argument
87-
// 'version', Stencil already supports this argument
88-
// 'watch', Stencil already supports this argument
89-
'watchAll',
90-
'watchman',
9133
] as const;
9234

9335
/**
9436
* All the Number options supported by the Stencil CLI
9537
*/
96-
export const NUMBER_CLI_FLAGS = [
97-
'port',
98-
// @deprecated - all JEST CLI args below are only used by integrated testing, which will be removed in Stencil v5.
99-
// See https://github.com/stenciljs/core/issues/6584.
100-
// JEST CLI ARGS
101-
'maxConcurrency',
102-
'testTimeout',
103-
] as const;
38+
export const NUMBER_CLI_FLAGS = ['port'] as const;
10439

10540
/**
10641
* All the String options supported by the Stencil CLI
@@ -112,88 +47,22 @@ export const STRING_CLI_FLAGS = [
11247
'docsJson',
11348
'emulate',
11449
'root',
115-
// @deprecated - screenshot testing will be removed in Stencil v5. See https://github.com/stenciljs/core/issues/6584.
116-
'screenshotConnector',
117-
118-
// @deprecated - all JEST CLI args below are only used by integrated testing, which will be removed in Stencil v5.
119-
// See https://github.com/stenciljs/core/issues/6584.
120-
// JEST CLI ARGS
121-
'cacheDirectory',
122-
'changedSince',
123-
'collectCoverageFrom',
124-
// 'config', Stencil already supports this argument
125-
'coverageDirectory',
126-
'coverageThreshold',
127-
'env',
128-
'filter',
129-
'globalSetup',
130-
'globalTeardown',
131-
'globals',
132-
'haste',
133-
'moduleNameMapper',
134-
'notifyMode',
135-
'outputFile',
136-
'preset',
137-
'prettierPath',
138-
'resolver',
139-
'rootDir',
140-
'runner',
141-
'testEnvironment',
142-
'testEnvironmentOptions',
143-
'testFailureExitCode',
144-
'testNamePattern',
145-
'testResultsProcessor',
146-
'testRunner',
147-
'testSequencer',
148-
'testURL',
149-
'timers',
150-
'transform',
15150
] as const;
15251

153-
// @deprecated - all entries below are JEST CLI args only used by integrated testing, which will be removed in Stencil v5.
154-
// See https://github.com/stenciljs/core/issues/6584.
155-
export const STRING_ARRAY_CLI_FLAGS = [
156-
'collectCoverageOnlyFrom',
157-
'coveragePathIgnorePatterns',
158-
'coverageReporters',
159-
'moduleDirectories',
160-
'moduleFileExtensions',
161-
'modulePathIgnorePatterns',
162-
'modulePaths',
163-
'projects',
164-
'reporters',
165-
'roots',
166-
'selectProjects',
167-
'setupFiles',
168-
'setupFilesAfterEnv',
169-
'snapshotSerializers',
170-
'testMatch',
171-
'testPathIgnorePatterns',
172-
'testPathPattern',
173-
'testRegex',
174-
'transformIgnorePatterns',
175-
'unmockedModulePathPatterns',
176-
'watchPathIgnorePatterns',
177-
] as const;
52+
export const STRING_ARRAY_CLI_FLAGS = [] as const;
17853

17954
/**
18055
* All the CLI arguments which may have string or number values
18156
*
182-
* `maxWorkers` is an argument which is used both by Stencil _and_ by Jest,
183-
* which means that we need to support parsing both string and number values.
57+
* `maxWorkers` controls the number of concurrent workers for Stencil builds.
58+
* Supports both string (e.g., "50%") and number values.
18459
*/
18560
export const STRING_NUMBER_CLI_FLAGS = ['maxWorkers'] as const;
18661

18762
/**
18863
* All the CLI arguments which may have boolean or string values.
18964
*/
19065
export const BOOLEAN_STRING_CLI_FLAGS = [
191-
/**
192-
* `headless` is an argument passed through to Puppeteer (which is passed to Chrome) for end-to-end testing.
193-
*
194-
* {@see https://developer.chrome.com/blog/chrome-headless-shell/}
195-
*/
196-
'headless',
19766
/**
19867
* `stats` is an argument that can optionally accept a file path where stats should be written.
19968
* When used as a boolean (--stats), it defaults to 'stencil-stats.json'.
@@ -245,25 +114,13 @@ export const CLI_FLAG_ALIASES: AliasMap = {
245114
h: 'help',
246115
p: 'port',
247116
v: 'version',
248-
249-
// JEST SPECIFIC CLI FLAGS
250-
// these are defined in
251-
// https://github.com/facebook/jest/blob/4156f86/packages/jest-cli/src/args.ts
252-
b: 'bail',
253-
e: 'expand',
254-
f: 'onlyFailures',
255-
i: 'runInBand',
256-
o: 'onlyChanged',
257-
t: 'testNamePattern',
258-
u: 'updateSnapshot',
259-
w: 'maxWorkers',
260117
};
261118

262119
/**
263120
* A regular expression which can be used to match a CLI flag for one of our
264121
* short aliases.
265122
*/
266-
export const CLI_FLAG_REGEX = new RegExp(`^-[chpvbewofitu]{1}$`);
123+
export const CLI_FLAG_REGEX = new RegExp(`^-[chpv]{1}$`);
267124

268125
/**
269126
* Given two types `K` and `T` where `K` extends `ReadonlyArray<string>`,

packages/cli/src/merge-flags.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ export const mergeFlags = (config: Config, flags: ConfigFlags): Config => {
9090
merged.generateServiceWorker = flags.serviceWorker;
9191
}
9292

93-
// --e2e → e2eTests
94-
if (typeof flags.e2e === 'boolean') {
95-
merged.e2eTests = flags.e2e;
96-
}
97-
9893
// --maxWorkers → maxConcurrentWorkers
9994
if (typeof flags.maxWorkers === 'number') {
10095
merged.maxConcurrentWorkers = flags.maxWorkers;

packages/cli/src/parse-flags.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,19 @@ const setCLIArg = (
255255

256256
// We're setting a string, but it's one where the user can pass multiple values,
257257
// like `--reporters="default" --reporters="jest-junit"`
258-
else if (readOnlyArrayHasStringMember(STRING_ARRAY_CLI_FLAGS, normalizedArg)) {
258+
// Note: STRING_ARRAY_CLI_FLAGS is currently empty, but we keep the infrastructure
259+
// for future CLI flags that accept multiple string values.
260+
else if (
261+
STRING_ARRAY_CLI_FLAGS.length > 0 &&
262+
readOnlyArrayHasStringMember(STRING_ARRAY_CLI_FLAGS, normalizedArg)
263+
) {
259264
if (typeof value === 'string') {
260-
if (!Array.isArray(flags[normalizedArg])) {
261-
flags[normalizedArg] = [];
265+
const flagsRecord = flags as unknown as Record<string, unknown>;
266+
if (!Array.isArray(flagsRecord[normalizedArg])) {
267+
flagsRecord[normalizedArg] = [];
262268
}
263269

264-
const targetArray = flags[normalizedArg];
270+
const targetArray = flagsRecord[normalizedArg];
265271
// this is irritating, but TS doesn't know that the `!Array.isArray`
266272
// check above guarantees we have an array to work with here, and it
267273
// doesn't want to narrow the type of `flags[normalizedArg]`, so we need

packages/cli/src/telemetry/_test_/telemetry.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,11 @@ describe('anonymizeConfigForTelemetry', () => {
259259
});
260260

261261
it.each<keyof d.ValidatedConfig>([
262-
'commonjs',
263262
'devServer',
264263
'env',
265264
'logger',
266265
'rolldownConfig',
267266
'sys',
268-
'testing',
269267
'tsCompilerOptions',
270268
])("should remove objects under prop '%s'", (prop: keyof d.ValidatedConfig) => {
271269
const anonymizedConfig = anonymizeConfigForTelemetry({

packages/cli/src/telemetry/telemetry.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,11 @@ const CONFIG_PROPS_TO_ANONYMIZE: ReadonlyArray<ConfigStringKeys> = [
260260
//
261261
// TODO(STENCIL-469): Investigate improving anonymization for tsCompilerOptions and devServer
262262
const CONFIG_PROPS_TO_DELETE: ReadonlyArray<keyof d.Config> = [
263-
'commonjs',
264263
'devServer',
265264
'env',
266265
'logger',
267266
'rolldownConfig',
268267
'sys',
269-
'testing',
270268
'tsCompilerOptions',
271269
];
272270

packages/core/src/app-data/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const BUILD: BuildConditionals = {
3131
hostListenerTargetWindow: true,
3232
hostListenerTargetDocument: true,
3333
hostListenerTargetBody: true,
34-
hostListenerTargetParent: false,
3534
hostListenerTarget: true,
3635
member: true,
3736
method: true,
@@ -95,8 +94,6 @@ export const BUILD: BuildConditionals = {
9594
initializeNextTick: false,
9695
asyncLoading: true,
9796
asyncQueue: false,
98-
// TODO: deprecated in favour of `setTagTransformer` and `transformTag`. Remove in 5.0
99-
transformTagName: false,
10097
attachStyles: true,
10198
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
10299
experimentalSlotFixes: false,

packages/core/src/compiler/app-core/app-data.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export const getBuildFeatures = (cmps: ComponentCompilerMeta[]): BuildFeatures =
3838
hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
3939
hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
4040
hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
41-
hostListenerTargetParent: cmps.some((c) => c.hasListenerTargetParent),
4241
hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
4342
member: cmps.some((c) => c.hasMember),
4443
method: cmps.some((c) => c.hasMethod),

0 commit comments

Comments
 (0)