@@ -26,11 +26,10 @@ import { rule as S5362 } from '../../css/src/rules/S5362/index.js';
2626import assert from 'node:assert' ;
2727import { toUnixPath } from '../../shared/src/helpers/files.js' ;
2828import { ProjectAnalysisInput } from '../../jsts/src/analysis/projectAnalysis/projectAnalysis.js' ;
29- import { readProtobufFromFilePath } from '../../jsts/src/parsers/ast.js' ;
29+ import { deserializeProtobuf } from '../../jsts/src/parsers/ast.js' ;
3030import { createAndSaveProgram } from '../../jsts/src/program/program.js' ;
3131import { RuleConfig } from '../../jsts/src/linter/config/rule-config.js' ;
3232import { createWorker } from '../../shared/src/helpers/worker.js' ;
33- import { join } from 'node:path/posix' ;
3433
3534describe ( 'router' , ( ) => {
3635 const fixtures = path . join ( import . meta. dirname , 'fixtures' , 'router' ) ;
@@ -109,32 +108,28 @@ describe('router', () => {
109108 } ) ;
110109
111110 it ( 'should route /analyze-jsts requests' , async ( ) => {
112- await requestInitLinter (
113- server ,
114- [
115- {
116- key : 'S6325' ,
117- configurations : [ ] ,
118- fileTypeTargets : [ 'MAIN' ] ,
119- language : 'js' ,
120- analysisModes : [ 'DEFAULT' ] ,
121- } ,
122- {
123- key : 'S4621' ,
124- configurations : [ ] ,
125- fileTypeTargets : [ 'MAIN' ] ,
126- language : 'ts' ,
127- analysisModes : [ 'DEFAULT' ] ,
128- } ,
129- ] ,
130- join ( fixtures , '.scannerwork' ) ,
131- ) ;
111+ await requestInitLinter ( server , [
112+ {
113+ key : 'S6325' ,
114+ configurations : [ ] ,
115+ fileTypeTargets : [ 'MAIN' ] ,
116+ language : 'js' ,
117+ analysisModes : [ 'DEFAULT' ] ,
118+ } ,
119+ {
120+ key : 'S4621' ,
121+ configurations : [ ] ,
122+ fileTypeTargets : [ 'MAIN' ] ,
123+ language : 'ts' ,
124+ analysisModes : [ 'DEFAULT' ] ,
125+ } ,
126+ ] ) ;
132127 let filePath = path . join ( fixtures , 'file.js' ) ;
133128 let fileType = 'MAIN' ;
134129 let data : any = { filePath, fileType, tsConfigs : [ ] } ;
135130 let response = await request ( server , '/analyze-jsts' , 'POST' , data ) ;
136131 let {
137- astFilePath ,
132+ ast ,
138133 issues : [ issue ] ,
139134 } = JSON . parse ( response ) ;
140135 expect ( issue ) . toEqual (
@@ -147,7 +142,7 @@ describe('router', () => {
147142 message : `Use a regular expression literal instead of the 'RegExp' constructor.` ,
148143 } ) ,
149144 ) ;
150- const protoMessage = await readProtobufFromFilePath ( astFilePath ) ;
145+ const protoMessage = deserializeProtobuf ( ast ) ;
151146 expect ( protoMessage . type ) . toEqual ( 0 ) ;
152147 expect ( protoMessage . program . body ) . toHaveLength ( 1 ) ;
153148 expect ( protoMessage . program . body [ 0 ] . expressionStatement . expression . newExpression ) . toBeDefined ( ) ;
@@ -362,7 +357,7 @@ describe('router', () => {
362357 } ) ;
363358} ) ;
364359
365- function requestInitLinter ( server : http . Server , rules : RuleConfig [ ] , rulesWorkdir ?: string ) {
366- const config = { rules, rulesWorkdir } ;
360+ function requestInitLinter ( server : http . Server , rules : RuleConfig [ ] ) {
361+ const config = { rules } ;
367362 return request ( server , '/init-linter' , 'POST' , config ) ;
368363}
0 commit comments