@t09tanaka/test-gates 0.5.1 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.2
4
+
5
+ ### Fixed
6
+
7
+ - `selfcheck --jobs` really no longer keeps every other control apart because of the word `require` in a string, a template, a comment or a regular expression. 0.5.1 fixed the reason given for a spec, but the plan of which controls run on their own still looked at the whole text.
8
+
3
9
  ## 0.5.1
4
10
 
5
11
  ### Fixed
package/dist/cli.js CHANGED
@@ -5447,6 +5447,9 @@ var REACHES = [
5447
5447
  ];
5448
5448
  var COMPUTED_LOAD = /(?:require|import)\((?!['"])|\brequire(?!\(|\.resolve\b|[\w$])|\bimport\.meta\.glob\b/;
5449
5449
  var COMPUTED = "loads a module whose name is computed";
5450
+ function loadsComputed(source) {
5451
+ return COMPUTED_LOAD.test(withoutLiterals(source).replace(/\s/g, ""));
5452
+ }
5450
5453
  var STRING = /(^|[:,([={?+&|;])(\s*)(['"])((?:\\.|(?!\3)[^\\\n])*)\3(?=\s*(?:[,}\]);:+?&|]|$))/gm;
5451
5454
  function withoutStrings(source) {
5452
5455
  return source.replace(
@@ -5537,13 +5540,12 @@ var PURE_BUILTINS = [
5537
5540
  ];
5538
5541
  var RUNNER_PACKAGES = ["vitest", "@jest/globals"];
5539
5542
  function reachesOutside(file, trusted) {
5540
- const dense = withoutLiterals(file.source).replace(/\s/g, "");
5541
5543
  const code = withoutStrings(file.source).replace(/\s/g, "");
5542
5544
  const mark = REACHES.find((text) => code.includes(text));
5543
5545
  if (mark !== void 0) {
5544
5546
  return `uses ${mark.replace(/[.?[(:]+$/, "")}`;
5545
5547
  }
5546
- if (COMPUTED_LOAD.test(dense)) {
5548
+ if (loadsComputed(file.source)) {
5547
5549
  return COMPUTED;
5548
5550
  }
5549
5551
  for (const { specifier, builtin } of file.imports) {
@@ -5583,7 +5585,7 @@ function jobsPlan(input) {
5583
5585
  const reaches = loaded.flatMap((file) => {
5584
5586
  const reach = reachesOutside(file, input.trusted);
5585
5587
  const said = reach === null ? [] : [`${file.path} ${reach}`];
5586
- if (!COMPUTED_LOAD.test(file.source.replace(/\s/g, ""))) {
5588
+ if (!loadsComputed(file.source)) {
5587
5589
  return said;
5588
5590
  }
5589
5591
  computed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t09tanaka/test-gates",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Test gates for the code that must not be wrong: per-file 100% coverage as the floor, mutation testing with a per-mutant allow list as the real check.",
5
5
  "author": "t09tanaka",
6
6
  "license": "MIT",