@output.ai/core 0.5.8 → 0.5.9
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/package.json
CHANGED
|
@@ -122,11 +122,11 @@ export const staticMatchers = {
|
|
|
122
122
|
* @param {string} path - Path to test
|
|
123
123
|
* @returns {boolean}
|
|
124
124
|
*/
|
|
125
|
-
sharedStepsDir: v => v.includes( `${sep}shared${sep}steps${sep}` ),
|
|
125
|
+
sharedStepsDir: v => v.includes( `${sep}shared${sep}steps${sep}` ) && v.endsWith( '.js' ),
|
|
126
126
|
/**
|
|
127
127
|
* Matches the shared folder for evaluators src/shared/evaluators/../evaluator_file.js
|
|
128
128
|
* @param {string} path - Path to test
|
|
129
129
|
* @returns {boolean}
|
|
130
130
|
*/
|
|
131
|
-
sharedEvaluatorsDir: v => v.includes( `${sep}shared${sep}evaluators${sep}` )
|
|
131
|
+
sharedEvaluatorsDir: v => v.includes( `${sep}shared${sep}evaluators${sep}` ) && v.endsWith( '.js' )
|
|
132
132
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
2
|
import { mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
3
3
|
import { join, sep } from 'node:path';
|
|
4
|
-
import { importComponents } from './loader_tools.js';
|
|
4
|
+
import { importComponents, staticMatchers } from './loader_tools.js';
|
|
5
5
|
|
|
6
6
|
describe( '.importComponents', () => {
|
|
7
7
|
const TEMP_BASE = join( process.cwd(), 'sdk/core/temp_test_modules' );
|
|
@@ -116,3 +116,41 @@ describe( '.importComponents', () => {
|
|
|
116
116
|
rmSync( root, { recursive: true, force: true } );
|
|
117
117
|
} );
|
|
118
118
|
} );
|
|
119
|
+
|
|
120
|
+
describe( '.staticMatchers', () => {
|
|
121
|
+
describe( '.sharedStepsDir', () => {
|
|
122
|
+
it( 'matches .js files inside shared/steps/', () => {
|
|
123
|
+
expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}tools.js` ) ).toBe( true );
|
|
124
|
+
} );
|
|
125
|
+
|
|
126
|
+
it( 'matches .js files in nested subdirectories of shared/steps/', () => {
|
|
127
|
+
expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}utils${sep}helper.js` ) ).toBe( true );
|
|
128
|
+
} );
|
|
129
|
+
|
|
130
|
+
it( 'rejects .ts files inside shared/steps/', () => {
|
|
131
|
+
expect( staticMatchers.sharedStepsDir( `${sep}app${sep}src${sep}shared${sep}steps${sep}tools.ts` ) ).toBe( false );
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
it( 'rejects non-.js files inside shared/steps/', () => {
|
|
135
|
+
expect( staticMatchers.sharedStepsDir( `${sep}app${sep}dist${sep}shared${sep}steps${sep}readme.md` ) ).toBe( false );
|
|
136
|
+
} );
|
|
137
|
+
} );
|
|
138
|
+
|
|
139
|
+
describe( '.sharedEvaluatorsDir', () => {
|
|
140
|
+
it( 'matches .js files inside shared/evaluators/', () => {
|
|
141
|
+
expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}quality.js` ) ).toBe( true );
|
|
142
|
+
} );
|
|
143
|
+
|
|
144
|
+
it( 'matches .js files in nested subdirectories of shared/evaluators/', () => {
|
|
145
|
+
expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}utils${sep}helper.js` ) ).toBe( true );
|
|
146
|
+
} );
|
|
147
|
+
|
|
148
|
+
it( 'rejects .ts files inside shared/evaluators/', () => {
|
|
149
|
+
expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}src${sep}shared${sep}evaluators${sep}quality.ts` ) ).toBe( false );
|
|
150
|
+
} );
|
|
151
|
+
|
|
152
|
+
it( 'rejects non-.js files inside shared/evaluators/', () => {
|
|
153
|
+
expect( staticMatchers.sharedEvaluatorsDir( `${sep}app${sep}dist${sep}shared${sep}evaluators${sep}readme.md` ) ).toBe( false );
|
|
154
|
+
} );
|
|
155
|
+
} );
|
|
156
|
+
} );
|