@atls/code-test 2.0.20 → 2.0.21

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,10 +1,17 @@
1
1
 
2
2
 
3
- ## [2.0.20](https://github.com/atls/raijin/compare/@atls/code-test@2.0.19...@atls/code-test@2.0.20) (2025-05-05)
3
+ ## [2.0.21](https://github.com/atls/raijin/compare/@atls/code-test@2.0.20...@atls/code-test@2.0.21) (2025-08-04)
4
+
5
+
6
+ ### Features
4
7
 
5
8
 
9
+ * **code:** test ignore ([e51d8e7](https://github.com/atls/raijin/commit/e51d8e7896b890e582e718e37362c2ca09e5dabb))
6
10
 
7
11
 
12
+
13
+ ## [2.0.20](https://github.com/atls/raijin/compare/@atls/code-test@2.0.19...@atls/code-test@2.0.20) (2025-05-05)
14
+
8
15
  ## [2.0.19](https://github.com/atls/raijin/compare/@atls/code-test@2.0.18...@atls/code-test@2.0.19) (2025-04-10)
9
16
 
10
17
  ### Bug Fixes
package/dist/tester.d.ts CHANGED
@@ -8,14 +8,17 @@ type TestOptions = {
8
8
  testReporter?: string;
9
9
  };
10
10
  export declare class Tester extends EventEmitter {
11
- constructor();
11
+ private readonly cwd;
12
+ private ignore;
13
+ constructor(cwd: string);
12
14
  protected run(files: Array<string>, timeout: number, concurrency: boolean, watch?: boolean, testReporter?: string): Promise<Array<TestEvent>>;
13
- static initialize(): Promise<Tester>;
15
+ static initialize(cwd: string): Promise<Tester>;
14
16
  unit(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
15
17
  integration(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
16
18
  general(cwd: string, options?: TestOptions): Promise<Array<TestEvent>>;
17
19
  private collectTestFiles;
18
20
  private isFilename;
19
21
  private isRootPath;
22
+ private getProjectIgnorePatterns;
20
23
  }
21
24
  export {};
package/dist/tester.js CHANGED
@@ -1,11 +1,19 @@
1
1
  import EventEmitter from 'node:events';
2
+ import { readFileSync } from 'node:fs';
3
+ import { relative } from 'node:path';
4
+ import { join } from 'node:path';
2
5
  import { run } from 'node:test';
3
6
  import { tap } from 'node:test/reporters';
4
7
  import { globby } from 'globby';
8
+ import ignorer from 'ignore';
5
9
  import { Tests } from './tests.js';
6
10
  export class Tester extends EventEmitter {
7
- constructor() {
11
+ cwd;
12
+ ignore;
13
+ constructor(cwd) {
8
14
  super();
15
+ this.cwd = cwd;
16
+ this.ignore = ignorer.default().add(this.getProjectIgnorePatterns());
9
17
  }
10
18
  async run(files, timeout, concurrency, watch = false, testReporter) {
11
19
  if (testReporter === 'tap') {
@@ -53,20 +61,23 @@ export class Tester extends EventEmitter {
53
61
  testsStream.off('test:stderr', onStderr);
54
62
  }
55
63
  }
56
- static async initialize() {
57
- return new Tester();
64
+ static async initialize(cwd) {
65
+ return new Tester(cwd);
58
66
  }
59
67
  async unit(cwd, options) {
60
68
  const testFiles = await this.collectTestFiles(cwd, 'unit', options?.files);
61
- return this.run(testFiles, 240_000, true, options?.watch, options?.testReporter);
69
+ const finalFiles = testFiles.filter((file) => this.ignore.filter([relative(this.cwd, file)]).length !== 0);
70
+ return this.run(finalFiles, 240_000, true, options?.watch, options?.testReporter);
62
71
  }
63
72
  async integration(cwd, options) {
64
73
  const testFiles = await this.collectTestFiles(cwd, 'integration', options?.files);
65
- return this.run(testFiles, 420_000, false, options?.watch, options?.testReporter);
74
+ const finalFiles = testFiles.filter((file) => this.ignore.filter([relative(this.cwd, file)]).length !== 0);
75
+ return this.run(finalFiles, 420_000, false, options?.watch, options?.testReporter);
66
76
  }
67
77
  async general(cwd, options) {
68
78
  const testFiles = await this.collectTestFiles(cwd, undefined, options?.files);
69
- return this.run(testFiles, 420_000, true, options?.watch, options?.testReporter);
79
+ const finalFiles = testFiles.filter((file) => this.ignore.filter([relative(this.cwd, file)]).length !== 0);
80
+ return this.run(finalFiles, 420_000, true, options?.watch, options?.testReporter);
70
81
  }
71
82
  async collectTestFiles(cwd, type, patterns) {
72
83
  let folderPattern = '*';
@@ -104,4 +115,9 @@ export class Tester extends EventEmitter {
104
115
  isRootPath(pattern) {
105
116
  return pattern.startsWith('/') || pattern.startsWith('\\');
106
117
  }
118
+ getProjectIgnorePatterns() {
119
+ const content = readFileSync(join(this.cwd, 'package.json'), 'utf-8');
120
+ const { testIgnorePatterns = [] } = JSON.parse(content);
121
+ return testIgnorePatterns;
122
+ }
107
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls/code-test",
3
- "version": "2.0.20",
3
+ "version": "2.0.21",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,8 +23,9 @@
23
23
  "postpack": "rm -rf dist"
24
24
  },
25
25
  "dependencies": {
26
- "@atls/code-runtime": "2.1.9",
27
- "globby": "13.2.2"
26
+ "@atls/code-runtime": "2.1.10",
27
+ "globby": "13.2.2",
28
+ "ignore": "5.3.2"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/node": "22.13.10"