@atls/code-test 2.0.7 → 2.0.8

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/dist/tester.d.ts CHANGED
@@ -10,6 +10,8 @@ export declare class Tester extends EventEmitter {
10
10
  constructor();
11
11
  static initialize(): Promise<Tester>;
12
12
  private collectTestFiles;
13
+ private isFilename;
14
+ private isRootPath;
13
15
  unit(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
14
16
  integration(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
15
17
  protected run(files: Array<string>, timeout: number, concurrency: boolean, watch: boolean): Promise<Array<TestEvent>>;
package/dist/tester.js CHANGED
@@ -20,7 +20,13 @@ export class Tester extends EventEmitter {
20
20
  });
21
21
  }
22
22
  return await globby(patterns.map((pattern) => {
23
- return `**/${folderPattern}/*${pattern}*.test.{ts,tsx,js,jsx}`;
23
+ if (this.isFilename(pattern)) {
24
+ return `**/${folderPattern}/*${pattern}*.test.{ts,tsx,js,jsx}`;
25
+ }
26
+ if (this.isRootPath(pattern)) {
27
+ return pattern;
28
+ }
29
+ return `**/${pattern}`;
24
30
  }), {
25
31
  cwd,
26
32
  dot: true,
@@ -28,6 +34,14 @@ export class Tester extends EventEmitter {
28
34
  ignore: ['**/node_modules/**', '**/dist/**', '**/.yarn/**'],
29
35
  });
30
36
  }
37
+ isFilename(pattern) {
38
+ const hasPathSeparator = pattern.includes('/') || pattern.includes('\\');
39
+ const hasValidExtension = /\.(js|jsx|ts|tsx)$/.test(pattern);
40
+ return !hasPathSeparator && !hasValidExtension;
41
+ }
42
+ isRootPath(pattern) {
43
+ return pattern.startsWith('/') || pattern.startsWith('\\');
44
+ }
31
45
  async unit(cwd, options) {
32
46
  const testFiles = await this.collectTestFiles(cwd, 'unit', options?.files);
33
47
  return this.run(testFiles, 25_000, true, options?.watch ?? false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/code-test",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {