Skip to content

Commit

Permalink
[fix] fix all cve warnings (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
allansson authored Nov 3, 2023
1 parent e56da17 commit b773f7d
Show file tree
Hide file tree
Showing 152 changed files with 5,663 additions and 7,434 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-slim
FROM node:20-alpine

WORKDIR /converter

Expand Down
10,406 changes: 4,037 additions & 6,369 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"verror": "^1.10.0"
},
"devDependencies": {
"@babel/core": "^7.18.6",
"@babel/preset-env": "^7.8.4",
"ava": "^2.4.0",
"babel-eslint": "^10.1.0",
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/eslint-parser": "7.22.15",
"ava": "^5.3.1",
"babel-loader": "^8.0.6",
"cross-env": "^5.2.0",
"eslint": "^7.1.0",
Expand Down Expand Up @@ -83,8 +83,9 @@
"eslint:recommended",
"prettier"
],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 2019,
"sourceType": "module"
},
Expand Down
440 changes: 440 additions & 0 deletions result.txt

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions test/int/parse/cookie.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import test from 'ava'
import cookie from 'parse/cookie'
import format from 'format'
import moment from 'moment'
const test = require('ava')
const cookie = require('parse/cookie')
const format = require('format')
const moment = require('moment')

function makeSpec() {
return new Map()
}

test('expires', (t) => {
test('expires', t => {
const time = moment.utc()
const spec = makeSpec()
cookie({ name: 'theme', expires: format.date.iso8601(time) }, spec)
Expand Down
30 changes: 21 additions & 9 deletions test/int/render/address/constructed.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import test from 'ava'
import isolate from 'helper/isolate'
import { requestFactor as makeRequestFactor, requestSpec as makeRequestSpec } from 'make'
const test = require('ava')
const isolate = require('helper/isolate')
const {
requestFactor: makeRequestFactor,
requestSpec: makeRequestSpec,
} = require('make')
const [constructed, { string }] = isolate(test, 'render/address/constructed', {
string: 'render/string',
})

test.serial('1', (t) => {
test.serial('1', t => {
const spec = makeRequestSpec()
spec.address = 'http://example.com'
spec.query.set('first', new Set([{ value: 'one' }]))
Expand All @@ -14,22 +17,31 @@ test.serial('1', (t) => {
t.is(string.firstCall.args[0], 'http://example.com/?first=one')
})

test.serial('3', (t) => {
test.serial('3', t => {
const spec = makeRequestSpec()
spec.address = 'http://example.com'
spec.query.set('first', new Set([{ value: 'one' }]))
spec.query.set('second', new Set([{ value: 'two' }]))
spec.query.set('third', new Set([{ value: 'three' }]))
const factor = makeRequestFactor()
constructed(spec, factor)
t.is(string.firstCall.args[0], 'http://example.com/?first=one&second=two&third=three')
t.is(
string.firstCall.args[0],
'http://example.com/?first=one&second=two&third=three'
)
})

test.serial('plural', (t) => {
test.serial('plural', t => {
const spec = makeRequestSpec()
spec.address = 'http://example.com'
spec.query.set('search', new Set([{ value: 'kitten' }, { value: 'puppy' }, { value: 'quokka' }]))
spec.query.set(
'search',
new Set([{ value: 'kitten' }, { value: 'puppy' }, { value: 'quokka' }])
)
const factor = makeRequestFactor()
constructed(spec, factor)
t.is(string.firstCall.args[0], 'http://example.com/?search=kitten&search=puppy&search=quokka')
t.is(
string.firstCall.args[0],
'http://example.com/?search=kitten&search=puppy&search=quokka'
)
})
14 changes: 7 additions & 7 deletions test/int/render/post/url/plural/fixed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava'
import isolate from 'helper/isolate'
const test = require('ava')
const isolate = require('helper/isolate')
const [fixed, { comment, note, string }] = isolate(
test,
'render/post/url/plural/fixed',
Expand All @@ -10,21 +10,21 @@ const [fixed, { comment, note, string }] = isolate(
}
)

test.serial('result', (t) => {
test.serial('result', t => {
string.returns('rendered')
const params = new Map()
const result = fixed(params)
t.true(string.calledOnce)
t.is(result, 'rendered')
})

test.serial('1', (t) => {
test.serial('1', t => {
const params = new Map().set('search', new Set([{ value: 'kitten' }]))
fixed(params)
t.is(string.firstCall.args[0], 'search=kitten')
})

test.serial('3', (t) => {
test.serial('3', t => {
const params = new Map()
.set('search', new Set([{ value: 'kitten' }]))
.set('filter', new Set([{ value: 'cute' }]))
Expand All @@ -33,7 +33,7 @@ test.serial('3', (t) => {
t.is(string.firstCall.args[0], 'search=kitten&filter=cute&order=cuteness')
})

test.serial('multivalue', (t) => {
test.serial('multivalue', t => {
const params = new Map().set(
'search',
new Set([{ value: 'kitten' }, { value: 'puppy' }, { value: 'quokka' }])
Expand All @@ -42,7 +42,7 @@ test.serial('multivalue', (t) => {
t.is(string.firstCall.args[0], 'search=kitten%2Cpuppy%2Cquokka')
})

test.serial('comment', (t) => {
test.serial('comment', t => {
note.returns('-search- Find kittens')
comment.returns('// -search- Find kittens')
string.returns('"search=kitten"')
Expand Down
14 changes: 7 additions & 7 deletions test/int/string/check/name/computed.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import test from 'ava'
import computed from 'string/check/name/computed'
import { CheckCondition, CheckSubject, CheckType } from 'enum'
const test = require('ava')
const computed = require('string/check/name/computed')
const { CheckCondition, CheckSubject, CheckType } = require('enum')

test('JSONPath', (t) => {
test('JSONPath', t => {
const name = computed({
type: CheckType.JSONPath,
expression: '$.result.token',
})
t.is(name, '$.result.token exists')
})

test('JSONPathValue', (t) => {
test('JSONPathValue', t => {
const name = computed({
type: CheckType.JSONPathValue,
expression: '$.user.id',
Expand All @@ -20,7 +20,7 @@ test('JSONPathValue', (t) => {
t.is(name, '$.user.id equals 8734')
})

test('Regex', (t) => {
test('Regex', t => {
const name = computed({
type: CheckType.Regex,
subject: CheckSubject.HttpStatusCode,
Expand All @@ -29,7 +29,7 @@ test('Regex', (t) => {
t.is(name, 'status matches /2\\d\\d/')
})

test('Text', (t) => {
test('Text', t => {
const name = computed({
type: CheckType.Text,
subject: CheckSubject.ResponseBody,
Expand Down
6 changes: 3 additions & 3 deletions test/unit/aid.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from 'ava'
import aid from 'aid'
const test = require('ava')
const aid = require('aid')

test('extrinsic', (t) => {
test('extrinsic', t => {
const enumeration = {
First: 0,
Second: 1,
Expand Down
42 changes: 21 additions & 21 deletions test/unit/codegen/index.test.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
import test from 'ava'
import { js, unquote, from } from '../../../src/codegen'
const test = require('ava')
const { js, unquote, from } = require('../../../src/codegen')

const opts = { validate: true }

test('should return same template when interpolation is not used', (t) => {
test('should return same template when interpolation is not used', t => {
const template = js`let test = "hello"`
const result = template({}, opts)

t.is('let test = "hello"', result)
})

test('should splice undefined value', (t) => {
test('should splice undefined value', t => {
const template = js`let test = ${undefined}`
const result = template({}, opts)

t.is('let test = undefined', result)
})

test('should splice null value', (t) => {
test('should splice null value', t => {
const template = js`let test = ${null}`
const result = template({}, opts)

t.is('let test = null', result)
})
test('should splice value of number value', (t) => {
test('should splice value of number value', t => {
const template = js`let test = ${3}`
const result = template({}, opts)

t.is('let test = 3', result)
})

test('should splice value of boolean value', (t) => {
test('should splice value of boolean value', t => {
const template = js`let test = ${false}`
const result = template({}, opts)

t.is('let test = false', result)
})

test('should splice value of string value', (t) => {
test('should splice value of string value', t => {
const template = js`let test = ${'hello'}`
const result = template({}, opts)

t.is('let test = "hello"', result)
})

test('should splice value of array literal', (t) => {
test('should splice value of array literal', t => {
const template = js`let test = ${[1, 2, 3]}`
const result = template({}, opts)

t.is('let test = [1,2,3]', result)
})

test('should splice value of object literal', (t) => {
test('should splice value of object literal', t => {
const template = js`let test = ${{ a: 1, b: 2, c: 3 }}`
const result = template({}, opts)

t.is('let test = {a:1,b:2,c:3}', result)
})

test(`should pass context on to functions passed to interpolation`, (t) => {
test(`should pass context on to functions passed to interpolation`, t => {
const template = js`let test = ${({ a, b }) => a + b}`
const result = template({ a: 1, b: 2 })

t.is('let test = 3', result)
})

test(`two templates should compose`, (t) => {
test(`two templates should compose`, t => {
const first = js`() => myFunc()`
const second = js`let test = ${first}`

Expand All @@ -74,7 +74,7 @@ test(`two templates should compose`, (t) => {
t.is('let test = () => myFunc()', result)
})

test(`context should be propagated to both composed templates`, (t) => {
test(`context should be propagated to both composed templates`, t => {
const first = js`() => myFunc(${({ a }) => a})`
const second = js`let test = ${first}`

Expand All @@ -83,42 +83,42 @@ test(`context should be propagated to both composed templates`, (t) => {
t.is('let test = () => myFunc("hello")', result)
})

test(`calling unquote should insert unescaped value`, (t) => {
test(`calling unquote should insert unescaped value`, t => {
const template = js`let ${unquote('test')} = true`
const result = template({ a: 'hello' }, opts)

t.is('let test = true', result)
})

test(`calling map on template should allow changes to the context`, (t) => {
const template = js`let test = ${(a) => a}`.map((a) => a + 1)
test(`calling map on template should allow changes to the context`, t => {
const template = js`let test = ${a => a}`.map(a => a + 1)
const result = template(1, opts)

t.is('let test = 2', result)
})

test(`calling inContext on template should replace context with the given context`, (t) => {
const template = js`let test = ${(a) => a}`.inContext(2)
test(`calling inContext on template should replace context with the given context`, t => {
const template = js`let test = ${a => a}`.inContext(2)
const result = template(1, opts)

t.is('let test = 2', result)
})

test(`calling assign on template should extend the given context with values of given object literal`, (t) => {
test(`calling assign on template should extend the given context with values of given object literal`, t => {
const template = js`let test = ${({ a, b }) => a + b}`.assign({ b: 2 })
const result = template({ a: 1 }, opts)

t.is('let test = 3', result)
})

test('using from function in interpolation should insert value of property from the context', (t) => {
test('using from function in interpolation should insert value of property from the context', t => {
const template = js`let test = ${from('myProp')}`
const result = template({ myProp: true }, opts)

t.is('let test = true', result)
})

test('using from function in interpolation should insert default value when property does not exist in context', (t) => {
test('using from function in interpolation should insert default value when property does not exist in context', t => {
const template = js`let test = ${from('myProp', false)}`
const result = template({}, opts)

Expand Down
4 changes: 2 additions & 2 deletions test/unit/convert.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava'
import convert from 'convert'
const test = require('ava')
const convert = require('convert')

// Should only include Scenario info if an array was passed to convert
test('throw with scenario info', async t => {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/interface.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import test from 'ava'
import isolate from 'helper/isolate'
const test = require('ava')
const isolate = require('helper/isolate')
const [harToK6, { parse, render, validate }] = isolate(test, 'index', {
parse: 'parse',
render: 'render',
validate: 'validate',
})

test.serial('liHARToK6Script', async (t) => {
test.serial('liHARToK6Script', async t => {
render.returns('result')
const result = await harToK6.liHARToK6Script()
t.deepEqual(result, { main: 'result' })
Expand Down
6 changes: 3 additions & 3 deletions test/unit/normalize/index.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava'
import normalize from '../../../src/normalize'
import { SleepPlacement } from '../../../src/enum'
const test = require('ava')
const normalize = require('../../../src/normalize')
const { SleepPlacement } = require('../../../src/enum')

class MockArchive {
constructor() {
Expand Down
Loading

0 comments on commit b773f7d

Please sign in to comment.