@atls/code-test 2.0.14 → 2.0.16

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,9 +1,36 @@
1
- ## <small>2.0.14 (2025-01-01)</small>
2
1
 
3
- * Merge pull request #475 from atls/fix/release ([a578cda](https://github.com/atls/raijin/commit/a578cda)), closes [#475](https://github.com/atls/raijin/issues/475)
4
2
 
3
+ ## [2.0.16](https://github.com/atls/raijin/compare/@atls/code-test@2.0.15...@atls/code-test@2.0.16) (2025-03-09)
4
+
5
+
6
+ ### Features
7
+
8
+
9
+ * **common:** bump ([#494](https://github.com/atls/raijin/issues/494)) ([381d535](https://github.com/atls/raijin/commit/381d5357c2818e157330933edb9256936d251ca3))
10
+
11
+
12
+
13
+ ## [2.0.15](https://github.com/atls/raijin/compare/@atls/code-test@2.0.15...@atls/code-test@2.0.15) (2025-03-09)
14
+
15
+ ### Features
5
16
 
17
+ - **common:** bump ([#494](https://github.com/atls/raijin/issues/494)) ([381d535](https://github.com/atls/raijin/commit/381d5357c2818e157330933edb9256936d251ca3))
18
+
19
+ ## [2.0.15](https://github.com/atls/raijin/compare/@atls/code-test@2.0.14...@atls/code-test@2.0.15) (2025-02-24)
20
+
21
+ ### Bug Fixes
22
+
23
+ - **common:** yarn check ([#485](https://github.com/atls/raijin/issues/485)) ([b0c3cfa](https://github.com/atls/raijin/commit/b0c3cfad8f559c55691ca733c7a3a7b3cd00c4d8))
24
+
25
+ ## [2.0.14](https://github.com/atls/raijin/compare/@atls/code-test@2.0.14...@atls/code-test@2.0.14) (2025-01-30)
26
+
27
+ ### Bug Fixes
28
+
29
+ - **common:** yarn check ([#485](https://github.com/atls/raijin/issues/485)) ([b0c3cfa](https://github.com/atls/raijin/commit/b0c3cfad8f559c55691ca733c7a3a7b3cd00c4d8))
30
+
31
+ ## <small>2.0.14 (2025-01-01)</small>
6
32
 
33
+ - Merge pull request #475 from atls/fix/release ([a578cda](https://github.com/atls/raijin/commit/a578cda)), closes [#475](https://github.com/atls/raijin/issues/475)
7
34
 
8
35
  ## <small>2.0.13 (2025-01-01)</small>
9
36
 
package/dist/tester.d.ts CHANGED
@@ -9,13 +9,13 @@ type TestOptions = {
9
9
  };
10
10
  export declare class Tester extends EventEmitter {
11
11
  constructor();
12
+ protected run(files: Array<string>, timeout: number, concurrency: boolean, watch?: boolean, testReporter?: string): Promise<Array<TestEvent>>;
12
13
  static initialize(): Promise<Tester>;
13
- private collectTestFiles;
14
- private isFilename;
15
- private isRootPath;
16
14
  unit(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
17
15
  integration(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
18
16
  general(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
19
- protected run(files: Array<string>, timeout: number, concurrency: boolean, watch?: boolean, testReporter?: string): Promise<Array<TestEvent>>;
17
+ private collectTestFiles;
18
+ private isFilename;
19
+ private isRootPath;
20
20
  }
21
21
  export {};
package/dist/tester.js CHANGED
@@ -7,57 +7,6 @@ export class Tester extends EventEmitter {
7
7
  constructor() {
8
8
  super();
9
9
  }
10
- static async initialize() {
11
- return new Tester();
12
- }
13
- async collectTestFiles(cwd, type, patterns) {
14
- let folderPattern = '*';
15
- if (type !== undefined) {
16
- folderPattern = type === 'unit' ? '!(integration)' : 'integration';
17
- }
18
- if (!patterns || patterns.length < 1) {
19
- return globby([`**/${folderPattern}/*.test.{ts,tsx,js,jsx}`], {
20
- cwd,
21
- dot: true,
22
- absolute: true,
23
- ignore: ['**/node_modules/**', '**/dist/**', '**/.yarn/**'],
24
- });
25
- }
26
- return globby(patterns.map((pattern) => {
27
- if (this.isFilename(pattern)) {
28
- return `**/${folderPattern}/*${pattern}*.test.{ts,tsx,js,jsx}`;
29
- }
30
- if (this.isRootPath(pattern)) {
31
- return pattern;
32
- }
33
- return `**/${pattern}`;
34
- }), {
35
- cwd,
36
- dot: true,
37
- absolute: true,
38
- ignore: ['**/node_modules/**', '**/dist/**', '**/.yarn/**'],
39
- });
40
- }
41
- isFilename(pattern) {
42
- const hasPathSeparator = pattern.includes('/') || pattern.includes('\\');
43
- const hasValidExtension = /\.(js|jsx|ts|tsx)$/.test(pattern);
44
- return !hasPathSeparator && !hasValidExtension;
45
- }
46
- isRootPath(pattern) {
47
- return pattern.startsWith('/') || pattern.startsWith('\\');
48
- }
49
- async unit(cwd, options) {
50
- const testFiles = await this.collectTestFiles(cwd, 'unit', options?.files);
51
- return this.run(testFiles, 25_000, true, options?.watch, options?.testReporter);
52
- }
53
- async integration(cwd, options) {
54
- const testFiles = await this.collectTestFiles(cwd, 'integration', options?.files);
55
- return this.run(testFiles, 240_000, false, options?.watch, options?.testReporter);
56
- }
57
- async general(cwd, options) {
58
- const testFiles = await this.collectTestFiles(cwd, undefined, options?.files);
59
- return this.run(testFiles, 240_000, true, options?.watch, options?.testReporter);
60
- }
61
10
  async run(files, timeout, concurrency, watch = false, testReporter) {
62
11
  if (testReporter === 'tap') {
63
12
  const result = run({
@@ -104,4 +53,55 @@ export class Tester extends EventEmitter {
104
53
  testsStream.off('test:stderr', onStderr);
105
54
  }
106
55
  }
56
+ static async initialize() {
57
+ return new Tester();
58
+ }
59
+ async unit(cwd, options) {
60
+ const testFiles = await this.collectTestFiles(cwd, 'unit', options?.files);
61
+ return this.run(testFiles, 25_000, true, options?.watch, options?.testReporter);
62
+ }
63
+ async integration(cwd, options) {
64
+ const testFiles = await this.collectTestFiles(cwd, 'integration', options?.files);
65
+ return this.run(testFiles, 240_000, false, options?.watch, options?.testReporter);
66
+ }
67
+ async general(cwd, options) {
68
+ const testFiles = await this.collectTestFiles(cwd, undefined, options?.files);
69
+ return this.run(testFiles, 240_000, true, options?.watch, options?.testReporter);
70
+ }
71
+ async collectTestFiles(cwd, type, patterns) {
72
+ let folderPattern = '*';
73
+ if (type !== undefined) {
74
+ folderPattern = type === 'unit' ? '!(integration)' : 'integration';
75
+ }
76
+ if (!patterns || patterns.length < 1) {
77
+ return globby([`**/${folderPattern}/*.test.{ts,tsx,js,jsx}`], {
78
+ cwd,
79
+ dot: true,
80
+ absolute: true,
81
+ ignore: ['**/node_modules/**', '**/dist/**', '**/.yarn/**'],
82
+ });
83
+ }
84
+ return globby(patterns.map((pattern) => {
85
+ if (this.isFilename(pattern)) {
86
+ return `**/${folderPattern}/*${pattern}*.test.{ts,tsx,js,jsx}`;
87
+ }
88
+ if (this.isRootPath(pattern)) {
89
+ return pattern;
90
+ }
91
+ return `**/${pattern}`;
92
+ }), {
93
+ cwd,
94
+ dot: true,
95
+ absolute: true,
96
+ ignore: ['**/node_modules/**', '**/dist/**', '**/.yarn/**'],
97
+ });
98
+ }
99
+ isFilename(pattern) {
100
+ const hasPathSeparator = pattern.includes('/') || pattern.includes('\\');
101
+ const hasValidExtension = /\.(js|jsx|ts|tsx)$/.test(pattern);
102
+ return !hasPathSeparator && !hasValidExtension;
103
+ }
104
+ isRootPath(pattern) {
105
+ return pattern.startsWith('/') || pattern.startsWith('\\');
106
+ }
107
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/code-test",
3
- "version": "2.0.14",
3
+ "version": "2.0.16",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,11 +23,11 @@
23
23
  "postpack": "rm -rf dist"
24
24
  },
25
25
  "dependencies": {
26
- "@atls/code-runtime": "2.1.2",
26
+ "@atls/code-runtime": "2.1.7",
27
27
  "globby": "13.2.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "22.9.0"
30
+ "@types/node": "22.13.10"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public",