From 75ff39d17c1edbb3f60688e229bb5eecb4f4f841 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 18 Mar 2024 15:18:20 +0100 Subject: [PATCH] fix test --- packages/jsts/tests/analysis/projectAnalyzer.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/jsts/tests/analysis/projectAnalyzer.test.ts b/packages/jsts/tests/analysis/projectAnalyzer.test.ts index d89541373c9..43f956ba36e 100644 --- a/packages/jsts/tests/analysis/projectAnalyzer.test.ts +++ b/packages/jsts/tests/analysis/projectAnalyzer.test.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import path from 'path'; -import { File, searchFiles, setContext, toUnixPath } from '@sonar/shared'; +import { File, getContext, searchFiles, setContext, toUnixPath } from '@sonar/shared'; import { analyzeProject, clearTSConfigs, ProjectAnalysisInput, RuleConfig } from '@sonar/jsts'; const defaultRules: RuleConfig[] = [ @@ -61,6 +61,7 @@ function prepareInput(files: Record[]>): ProjectAnalysisInput rules: defaultRules, baseDir: fixtures, files: filesDBtoFilesInput(files), + isSonarlint: getContext().sonarlint, }; } @@ -92,6 +93,12 @@ describe('analyzeProject', () => { }); it('should analyze the whole project with watch program', async () => { + setContext({ + workDir: '/tmp/dir', + shouldUseTypeScriptParserForJS: true, + sonarlint: true, + bundles: [], + }); const { files } = searchFiles(fixtures, { files: { pattern: '*.js,*.ts,*.vue' } }, []); const result = await analyzeProject(prepareInput(files as Record[]>)); expect(result).toBeDefined();