Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vdiez committed Mar 18, 2024
1 parent 58820cb commit 75ff39d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/jsts/tests/analysis/projectAnalyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down Expand Up @@ -61,6 +61,7 @@ function prepareInput(files: Record<string, File<void>[]>): ProjectAnalysisInput
rules: defaultRules,
baseDir: fixtures,
files: filesDBtoFilesInput(files),
isSonarlint: getContext().sonarlint,
};
}

Expand Down Expand Up @@ -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<string, File<void>[]>));
expect(result).toBeDefined();
Expand Down

0 comments on commit 75ff39d

Please sign in to comment.