tstyche 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,10 +64,10 @@ Here is the list of all matchers:
64
64
 
65
65
  ## Runner
66
66
 
67
- The `tstyche` command is the heart of TSTyche. For example, it can select test files by path, filter tests by name and pass them through TypeScript `4.8` and `latest`:
67
+ The `tstyche` command is the heart of TSTyche. For example, it can select test files by path, filter tests by name and pass them through a range of TypeScript versions:
68
68
 
69
- ```sh
70
- tstyche JsonObject --only external --target 4.8,latest
69
+ ```shell
70
+ tstyche query-params --only multiple --target '>=5.0 <5.3'
71
71
  ```
72
72
 
73
73
  This simple! (And it has watch mode too.)
package/build/tstyche.js CHANGED
@@ -824,13 +824,14 @@ class Store {
824
824
 
825
825
  class Target {
826
826
  static #rangeRegex = /^[<>]=?\d\.\d( [<>]=?\d\.\d)?$/;
827
- static expand(queries) {
827
+ static async expand(queries) {
828
828
  const include = [];
829
829
  for (const query of queries) {
830
830
  if (!Target.isRange(query)) {
831
831
  include.push(query);
832
832
  continue;
833
833
  }
834
+ await Store.open();
834
835
  if (Store.manifest != null) {
835
836
  let versions = Object.keys(Store.manifest.resolutions).slice(0, -4);
836
837
  for (const comparator of query.split(" ")) {
@@ -842,14 +843,16 @@ class Target {
842
843
  return include;
843
844
  }
844
845
  static #filter(comparator, versions) {
845
- const targetVersionIndex = versions.findIndex((version) => version === comparator.replace(/^[<>]=?/, ""));
846
- if (targetVersionIndex !== -1) {
847
- switch (comparator.charAt(0)) {
848
- case ">":
849
- return versions.slice(comparator.charAt(1) === "=" ? targetVersionIndex : targetVersionIndex + 1);
850
- case "<":
851
- return versions.slice(0, comparator.charAt(1) === "=" ? targetVersionIndex + 1 : targetVersionIndex);
852
- }
846
+ const targetVersion = comparator.replace(/^[<>]=?/, "");
847
+ switch (comparator.charAt(0)) {
848
+ case ">":
849
+ return versions.filter((sourceVersion) => comparator.charAt(1) === "="
850
+ ? Version.isSatisfiedWith(sourceVersion, targetVersion)
851
+ : Version.isGreaterThan(sourceVersion, targetVersion));
852
+ case "<":
853
+ return versions.filter((sourceVersion) => comparator.charAt(1) === "="
854
+ ? Version.isSatisfiedWith(targetVersion, sourceVersion)
855
+ : Version.isGreaterThan(targetVersion, sourceVersion));
853
856
  }
854
857
  return [];
855
858
  }
@@ -1083,18 +1086,7 @@ class Options {
1083
1086
  break;
1084
1087
  case "target": {
1085
1088
  if (/[<>=]/.test(optionValue)) {
1086
- if (Target.isRange(optionValue)) {
1087
- for (const value of optionValue.split(" ").map((value) => value.replace(/^[<>]=?/, ""))) {
1088
- if ((await Store.validateTag(value)) === false) {
1089
- onDiagnostics(Diagnostic.error([
1090
- ConfigDiagnosticText.versionIsNotSupported(value),
1091
- ...ConfigDiagnosticText.usage(optionName, optionBrand),
1092
- ConfigDiagnosticText.inspectSupportedVersions(),
1093
- ], origin));
1094
- }
1095
- }
1096
- }
1097
- else {
1089
+ if (!Target.isRange(optionValue)) {
1098
1090
  onDiagnostics(Diagnostic.error([ConfigDiagnosticText.rangeIsNotValid(optionValue), ...ConfigDiagnosticText.rangeUsage()], origin));
1099
1091
  }
1100
1092
  break;
@@ -1502,6 +1494,9 @@ class Config {
1502
1494
  const pathMatch = [];
1503
1495
  const commandLineParser = new CommandLineParser(commandLineOptions, pathMatch, Config.#onDiagnostics);
1504
1496
  await commandLineParser.parse(commandLine);
1497
+ if (commandLineOptions.target != null) {
1498
+ commandLineOptions.target = await Target.expand(commandLineOptions.target);
1499
+ }
1505
1500
  return { commandLineOptions, pathMatch };
1506
1501
  }
1507
1502
  static async parseConfigFile(filePath) {
@@ -1516,6 +1511,9 @@ class Config {
1516
1511
  const sourceFile = new SourceFile(configFilePath, configFileText);
1517
1512
  const configFileParser = new ConfigFileParser(configFileOptions, sourceFile, Config.#onDiagnostics);
1518
1513
  await configFileParser.parse();
1514
+ if (configFileOptions.target != null) {
1515
+ configFileOptions.target = await Target.expand(configFileOptions.target);
1516
+ }
1519
1517
  }
1520
1518
  return { configFileOptions, configFilePath };
1521
1519
  }
@@ -1530,7 +1528,6 @@ class Config {
1530
1528
  if ("config" in resolvedConfig) {
1531
1529
  delete resolvedConfig.config;
1532
1530
  }
1533
- resolvedConfig.target = Target.expand(resolvedConfig.target);
1534
1531
  return resolvedConfig;
1535
1532
  }
1536
1533
  static resolveConfigFilePath(filePath) {
@@ -4273,7 +4270,7 @@ class TaskRunner {
4273
4270
  class Runner {
4274
4271
  #eventEmitter = new EventEmitter();
4275
4272
  #resolvedConfig;
4276
- static version = "3.1.0";
4273
+ static version = "3.1.1";
4277
4274
  constructor(resolvedConfig) {
4278
4275
  this.#resolvedConfig = resolvedConfig;
4279
4276
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tstyche",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "The Essential Type Testing Tool.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -64,7 +64,7 @@
64
64
  "@biomejs/biome": "1.9.4",
65
65
  "@rollup/plugin-typescript": "12.1.1",
66
66
  "@types/node": "22.10.1",
67
- "@types/react": "18.3.12",
67
+ "@types/react": "18.3.13",
68
68
  "ajv": "8.17.1",
69
69
  "cspell": "8.16.1",
70
70
  "magic-string": "0.30.14",