Skip to content

Commit

Permalink
roll back to working tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Dec 22, 2024
1 parent 1c58e9d commit 537ae97
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/integration/cli.args-pass-through.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const { join } = require('path')
const { readFileSync } = require('fs')
const { mkdirSync, readFileSync } = require('fs')

const { describe, expect, test } = require('@jest/globals')

Expand All @@ -31,6 +31,7 @@ describe('integration.cli.args-pass-through', () => {

describe('npm-version depending npm-args', () => {
const tmpRootRun = join(tmpRoot, 'npmVersion-depending-npmArgs')
mkdirSync(tmpRootRun)

const rMinor = Math.round(99 * Math.random())
const rPatch = Math.round(99 * Math.random())
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/cli.edge-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const { join } = require('path')
const { writeFileSync, readFileSync } = require('fs')
const { mkdirSync, writeFileSync, readFileSync } = require('fs')

const { describe, expect, test } = require('@jest/globals')

Expand All @@ -32,6 +32,7 @@ describe('integration.cli.edge-cases', () => {

describe('broken project', () => {
const tmpRootRun = join(tmpRoot, 'broken-project')
mkdirSync(tmpRootRun)

test.each([
['no-lockfile', /missing evidence/i],
Expand All @@ -53,6 +54,7 @@ describe('integration.cli.edge-cases', () => {

describe('with broken npm-ls', () => {
const tmpRootRun = join(tmpRoot, 'with-broken')
mkdirSync(tmpRootRun)

test('error on non-existing binary', async () => {
const logFileBase = join(tmpRootRun, 'non-existing')
Expand Down Expand Up @@ -113,6 +115,7 @@ describe('integration.cli.edge-cases', () => {
test('suppressed error on non-zero exit', async () => {
const dd = { subject: 'dev-dependencies', npm: '8', node: '14', os: 'ubuntu-latest' }

mkdirSync(join(tmpRoot, 'suppressed-error-on-non-zero-exit'))
const expectedOutSnap = join(demoResultsRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`)
const logFileBase = join(tmpRoot, 'suppressed-error-on-non-zero-exit', `${dd.subject}_npm${dd.npm}_node${dd.node}_${dd.os}`)
const cwd = dummyProjectsRoot
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/cli.from-collected.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
*/

const { join } = require('path')
const { writeFileSync, readFileSync } = require('fs')
const { mkdirSync, writeFileSync, readFileSync } = require('fs')

const { describe, expect, test } = require('@jest/globals')

Expand All @@ -35,6 +35,7 @@ describe('integration.cli.from-collected', () => {
const LATETS_NPM = '10'

const tmpRootRun = join(tmpRoot, 'with-prepared')
mkdirSync(tmpRootRun)

const _allDemoCases = indexNpmLsDemoData()
const useCases = [
Expand All @@ -56,6 +57,8 @@ describe('integration.cli.from-collected', () => {
]

describe.each(useCases)('$subject', (ud) => {
mkdirSync(join(tmpRootRun, ud.subject))

test.each(ud.demoCases)('$subject $args npm$npm node$node $os', async (dd) => {
const expectedOutSnap = join(demoResultsRoot, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}.snap.json`)
const logFileBase = join(tmpRootRun, ud.subject, `${dd.subject}${dd.args}_npm${dd.npm}_node${dd.node}_${dd.os}`)
Expand Down

0 comments on commit 537ae97

Please sign in to comment.