Skip to content

Commit 0d6232a

Browse files
1 parent fa00a9c commit 0d6232a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

tools/spectral/ipa/__tests__/metrics/metricCollection.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path';
33
import { fileURLToPath } from 'url';
44
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
55
import { runMetricCollectionJob } from '../../metrics/metricCollection.js';
6-
import * as spectral from '@stoplight/spectral-core';
6+
import { Spectral } from '@stoplight/spectral-core';
77

88
const dirname = path.dirname(fileURLToPath(require('url').pathToFileURL(__filename).toString()));
99
const expectedResultFilePath = path.join(dirname, 'data', 'expected-metric-results.json');
@@ -26,6 +26,7 @@ describe('tools/spectral/ipa/metrics/metricCollection.js runMetricCollectionJob'
2626

2727
it('Outputs the expected metrics collection results', async () => {
2828
const expectedResults = JSON.parse(fs.readFileSync(expectedResultFilePath, 'utf8'));
29+
const spectral = new Spectral();
2930

3031
const results = await runMetricCollectionJob(testConfig, spectral);
3132

tools/spectral/ipa/metrics/scripts/runMetricCollection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import spectral from '@stoplight/spectral-core';
44
import config from '../config.js';
55
import { runMetricCollectionJob } from '../metricCollection.js';
66

7+
const { Spectral } = spectral;
78
const args = process.argv.slice(2);
89
const oasFilePath = args[0];
910

@@ -25,7 +26,7 @@ runMetricCollectionJob(
2526
{
2627
oasFilePath,
2728
},
28-
spectral
29+
new Spectral()
2930
)
3031
.then((results) => {
3132
console.log('Writing results');

tools/spectral/ipa/metrics/utils.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ export function getSeverityPerRule(ruleset) {
2121
}
2222

2323
export async function loadRuleset(rulesetPath, spectral) {
24-
const { Spectral } = spectral;
25-
2624
try {
27-
const spectral = new Spectral();
2825
const ruleset = await bundleAndLoadRuleset(rulesetPath, { fs, fetch });
2926
await spectral.setRuleset(ruleset);
3027
return ruleset;

0 commit comments

Comments
 (0)