Skip to content

Commit

Permalink
fix: fix valid SARIF json-schema test by vendoring schema
Browse files Browse the repository at this point in the history
  • Loading branch information
WitoDelnat committed Oct 11, 2023
1 parent 9547f3b commit 49fbd5b
Show file tree
Hide file tree
Showing 2 changed files with 2,885 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/validation/src/__tests__/MonokleValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {DisabledFixer, readConfig, RuleConfigMetadataType, SchemaLoader, SimpleC
import {defineRule} from '../custom.js';
import {isDeployment} from '../validators/custom/schemas/deployment.apps.v1.js';
import {DefaultPluginLoader} from '../pluginLoaders/PluginLoader.js';
import {readFile} from 'fs/promises';

it('should be simple to configure', async () => {
const parser = new ResourceParser();
Expand Down Expand Up @@ -241,9 +242,8 @@ it('should be valid SARIF', async () => {
allErrors: true,
});

const res = await fetch('https://json.schemastore.org/sarif-2.1.0.json');
if (!res.ok) throw new Error('schema_download_failed');
const schema = await res.json();
const res = await readFile('src/__tests__/resources/sarif-schema.json', 'utf-8');
const schema = JSON.parse(res);

const validateSarif = ajv.compile(schema);
validateSarif(response);
Expand Down
Loading

0 comments on commit 49fbd5b

Please sign in to comment.