Skip to content

Commit edd8264

Browse files
committed
fix lint issues
1 parent 032508b commit edd8264

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

src/commands/scan/cmd-scan-reach.e2e.test.mts

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ async function createTempMonoProject(
135135
await fs.mkdir(tempDir, { recursive: true })
136136

137137
// Copy each fixture into a subdirectory.
138-
for (const fixtureName of fixtureNames) {
139-
const sourceDir = path.join(fixtureBaseDir, fixtureName)
140-
const destDir = path.join(tempDir, fixtureName)
141-
await fs.cp(sourceDir, destDir, { recursive: true })
142-
}
138+
await Promise.all(
139+
fixtureNames.map(async fixtureName => {
140+
const sourceDir = path.join(fixtureBaseDir, fixtureName)
141+
const destDir = path.join(tempDir, fixtureName)
142+
await fs.cp(sourceDir, destDir, { recursive: true })
143+
}),
144+
)
143145

144146
return {
145147
cleanup: async () => {
@@ -208,7 +210,9 @@ function findReachabilityForGhsa(
208210
if (!component.reachability) {
209211
return undefined
210212
}
211-
const ghsaReachability = component.reachability.find(r => r.ghsa_id === ghsaId)
213+
const ghsaReachability = component.reachability.find(
214+
r => r.ghsa_id === ghsaId,
215+
)
212216
if (!ghsaReachability) {
213217
return undefined
214218
}
@@ -231,18 +235,15 @@ describe('socket scan reach (E2E tests)', async () => {
231235
const { binCliPath } = constants
232236
const testTimeout = 120_000
233237
const apiToken = process.env['SOCKET_CLI_API_TOKEN']
234-
const orgSlug = process.env['SOCKET_ORG'] || 'SocketDev'
238+
const orgSlug = process.env['SOCKET_ORG'] ?? 'SocketDev'
235239

236240
if (!apiToken) {
237-
logger.warn(
238-
'Skipping E2E tests: SOCKET_CLI_API_TOKEN environment variable not set',
239-
)
240-
return
241+
throw new Error('SOCKET_CLI_API_TOKEN environment variable not set')
241242
}
242243

243244
describe('npm-test-workspace-mono', () => {
244245
cmdit(
245-
['scan', 'reach', '.', '--no-interactive'],
246+
['scan', 'reach', '.', '--no-interactive', '--reach-disable-analytics'],
246247
'should run reachability analysis on workspace mono project',
247248
async cmd => {
248249
const tempFixture = await createTempFixtureCopy(
@@ -364,7 +365,6 @@ describe('socket scan reach (E2E tests)', async () => {
364365
'GHSA-35jh-r3h4-6jhm should be unreachable in packages/package-b',
365366
).toBe('unreachable')
366367

367-
368368
// Verify component structure.
369369
for (const component of facts.components.slice(0, 5)) {
370370
expect(component).toHaveProperty('id')
@@ -393,6 +393,7 @@ describe('socket scan reach (E2E tests)', async () => {
393393
'reach',
394394
'.',
395395
'--no-interactive',
396+
'--reach-disable-analytics',
396397
'--reach-exclude-paths',
397398
'packages/package-b',
398399
],
@@ -485,7 +486,15 @@ describe('socket scan reach (E2E tests)', async () => {
485486

486487
describe('multi-ecosystem filtering', () => {
487488
cmdit(
488-
['scan', 'reach', '.', '--no-interactive', '--reach-ecosystems', 'pypi'],
489+
[
490+
'scan',
491+
'reach',
492+
'.',
493+
'--no-interactive',
494+
'--reach-ecosystems',
495+
'pypi',
496+
'--reach-disable-analytics',
497+
],
489498
'should only analyze pypi ecosystem when --reach-ecosystems pypi is specified',
490499
async cmd => {
491500
// Create a mono project with both npm and pypi projects.
@@ -552,7 +561,9 @@ describe('socket scan reach (E2E tests)', async () => {
552561

553562
// If we have pypi components, verify their structure.
554563
if (componentTypes.has('pypi')) {
555-
const pypiComponents = facts.components.filter(c => c.type === 'pypi')
564+
const pypiComponents = facts.components.filter(
565+
c => c.type === 'pypi',
566+
)
556567
for (const component of pypiComponents.slice(0, 3)) {
557568
expect(component).toHaveProperty('name')
558569
expect(component).toHaveProperty('version')
@@ -576,7 +587,15 @@ describe('socket scan reach (E2E tests)', async () => {
576587
)
577588

578589
cmdit(
579-
['scan', 'reach', '.', '--no-interactive', '--reach-ecosystems', 'npm'],
590+
[
591+
'scan',
592+
'reach',
593+
'.',
594+
'--no-interactive',
595+
'--reach-ecosystems',
596+
'npm',
597+
'--reach-disable-analytics',
598+
],
580599
'should only analyze npm ecosystem when --reach-ecosystems npm is specified',
581600
async cmd => {
582601
// Create a mono project with both npm and pypi projects.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
const l = require('lodash')
22

3-
console.log(l.defaultsDeep({}, { a: 1, b: 2, c: 3 }));
3+
console.log(l.defaultsDeep({}, { a: 1, b: 2, c: 3 }))

0 commit comments

Comments
 (0)