ava 4.0.0-alpha.2 → 4.0.0-rc.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.
Files changed (66) hide show
  1. package/entrypoints/cli.mjs +3 -2
  2. package/entrypoints/eslint-plugin-helper.cjs +12 -5
  3. package/entrypoints/main.cjs +1 -1
  4. package/entrypoints/main.mjs +2 -1
  5. package/entrypoints/plugin.cjs +1 -1
  6. package/entrypoints/plugin.mjs +2 -2
  7. package/index.d.ts +6 -679
  8. package/lib/api.js +89 -43
  9. package/lib/assert.js +122 -173
  10. package/lib/chalk.js +10 -14
  11. package/lib/cli.js +100 -97
  12. package/lib/code-excerpt.js +12 -11
  13. package/lib/concordance-options.js +28 -30
  14. package/lib/context-ref.js +3 -6
  15. package/lib/create-chain.js +32 -4
  16. package/lib/environment-variables.js +1 -4
  17. package/lib/eslint-plugin-helper-worker.js +16 -26
  18. package/lib/extensions.js +2 -2
  19. package/lib/fork.js +35 -25
  20. package/lib/glob-helpers.cjs +140 -0
  21. package/lib/globs.js +137 -162
  22. package/lib/{ipc-flow-control.js → ipc-flow-control.cjs} +1 -0
  23. package/lib/is-ci.js +4 -2
  24. package/lib/like-selector.js +7 -13
  25. package/lib/line-numbers.js +10 -17
  26. package/lib/load-config.js +60 -56
  27. package/lib/module-types.js +3 -3
  28. package/lib/node-arguments.js +4 -5
  29. package/lib/{now-and-timers.js → now-and-timers.cjs} +0 -0
  30. package/lib/parse-test-args.js +22 -11
  31. package/lib/pkg.cjs +2 -0
  32. package/lib/plugin-support/shared-worker-loader.js +17 -28
  33. package/lib/plugin-support/shared-workers.js +17 -21
  34. package/lib/provider-manager.js +20 -14
  35. package/lib/reporters/beautify-stack.js +6 -11
  36. package/lib/reporters/colors.js +40 -15
  37. package/lib/reporters/default.js +115 -350
  38. package/lib/reporters/format-serialized-error.js +7 -18
  39. package/lib/reporters/improper-usage-messages.js +8 -9
  40. package/lib/reporters/prefix-title.js +17 -15
  41. package/lib/reporters/tap.js +15 -16
  42. package/lib/run-status.js +25 -23
  43. package/lib/runner.js +136 -125
  44. package/lib/scheduler.js +42 -36
  45. package/lib/serialize-error.js +34 -34
  46. package/lib/snapshot-manager.js +71 -68
  47. package/lib/test.js +114 -195
  48. package/lib/watcher.js +65 -40
  49. package/lib/worker/base.js +45 -96
  50. package/lib/worker/{channel.js → channel.cjs} +14 -14
  51. package/lib/worker/dependency-tracker.js +22 -22
  52. package/lib/worker/guard-environment.cjs +20 -0
  53. package/lib/worker/line-numbers.js +57 -19
  54. package/lib/worker/main.cjs +12 -0
  55. package/lib/worker/{options.js → options.cjs} +0 -0
  56. package/lib/worker/{plugin.js → plugin.cjs} +23 -12
  57. package/lib/worker/state.cjs +5 -0
  58. package/lib/worker/{utils.js → utils.cjs} +1 -1
  59. package/package.json +46 -61
  60. package/plugin.d.ts +51 -53
  61. package/readme.md +5 -9
  62. package/types/assertions.d.ts +327 -0
  63. package/types/subscribable.ts +6 -0
  64. package/types/test-fn.d.ts +231 -0
  65. package/types/try-fn.d.ts +58 -0
  66. package/lib/worker/main.js +0 -3
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import * as cli from '../lib/cli.js'; // eslint-disable-line import/extensions
3
- cli.run();
2
+ import run from '../lib/cli.js';
3
+
4
+ run();
@@ -4,7 +4,14 @@ const url = require('url');
4
4
  const v8 = require('v8');
5
5
  const {Worker} = require('worker_threads');
6
6
 
7
- const {classify, hasExtension, isHelperish, matches, normalizeFileForMatching, normalizePatterns} = require('../lib/globs');
7
+ const {
8
+ classify,
9
+ hasExtension,
10
+ isHelperish,
11
+ matches,
12
+ normalizeFileForMatching,
13
+ normalizePatterns,
14
+ } = require('../lib/glob-helpers.cjs');
8
15
 
9
16
  const MAX_DATA_LENGTH_EXCLUSIVE = 100 * 1024; // Allocate 100 KiB to exchange globs.
10
17
 
@@ -25,15 +32,15 @@ const resolveGlobsSync = (projectDir, overrideExtensions, overrideFiles) => {
25
32
  workerData: {
26
33
  dataBuffer,
27
34
  syncBuffer,
28
- firstMessage: {projectDir, overrideExtensions, overrideFiles}
29
- }
35
+ firstMessage: {projectDir, overrideExtensions, overrideFiles},
36
+ },
30
37
  });
31
38
  worker.unref();
32
39
  } else {
33
40
  worker.postMessage({projectDir, overrideExtensions, overrideFiles});
34
41
  }
35
42
 
36
- const synchronize = Atomics.wait(sync, 0, 0, 10000);
43
+ const synchronize = Atomics.wait(sync, 0, 0, 10_000);
37
44
  if (synchronize === 'timed-out') {
38
45
  throw new Error('Timed out resolving AVA configuration');
39
46
  }
@@ -93,7 +100,7 @@ function load(projectDir, overrides) {
93
100
  // Add the first extension. If multiple extensions are available, assume
94
101
  // patterns are not biased to any particular extension.
95
102
  return classifyForESLint(`${importPath}.${globs.extensions[0]}`);
96
- }
103
+ },
97
104
  });
98
105
  helperCache.set(cacheKey, helper);
99
106
  return helper;
@@ -1,2 +1,2 @@
1
1
  'use strict';
2
- module.exports = require('../lib/worker/main');
2
+ module.exports = require('../lib/worker/main.cjs');
@@ -1,2 +1,3 @@
1
- import test from '../lib/worker/main.js'; // eslint-disable-line import/extensions
1
+ import test from '../lib/worker/main.cjs';
2
+
2
3
  export default test;
@@ -1,2 +1,2 @@
1
1
  'use strict';
2
- module.exports = require('../lib/worker/plugin');
2
+ module.exports = require('../lib/worker/plugin.cjs');
@@ -1,4 +1,4 @@
1
- 'use strict';
2
- import * as plugin from '../lib/worker/plugin.js'; // eslint-disable-line import/extensions
1
+ import * as plugin from '../lib/worker/plugin.cjs';
2
+
3
3
  const {registerSharedWorker} = plugin;
4
4
  export {registerSharedWorker};