Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESLint Babel-based configuration to tests #82

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.cache/
build/
public/
node_modules/
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"extends": ["eslint:recommended"],
"plugins": ["@babel"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"requireConfigFile": false
},
"globals": {
// Allow specific global types present in the k6 JS runtime natively
"Uint8Array": "readonly",
"Set": "readonly",
"console": "readonly",
"__ENV": "readonly",
"open": "readonly"
}
}
17 changes: 5 additions & 12 deletions examples/kinesis.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import exec from 'k6/execution'

import { AWSConfig, KinesisClient } from '../build/kinesis.js'
import encoding from 'k6/encoding'
import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.2/index.js'
import { fail } from 'k6'

const dummyStream = `kinesis-test-stream-provisioned`
Expand All @@ -16,11 +13,6 @@ const awsConfig = new AWSConfig({

const kinesis = new KinesisClient(awsConfig)

const getShardIterator = async (shardId) => {
const res = await kinesis.getShardIterator(dummyStream, shardId, `TRIM_HORIZON`)
return res.ShardIterator
}

export default async function () {
// List the streamds the AWS authentication configuration
// gives us access to.
Expand All @@ -39,7 +31,7 @@ export default async function () {
})

// Put some records in it
const records = await kinesis.putRecords({
await kinesis.putRecords({
StreamName: dummyStream,
Records: [
{
Expand All @@ -58,14 +50,15 @@ export default async function () {

// For each shard, read all the data
shards.map(async (shard) => {
const iterator = await kinesis.getShardIterator(dummyStream, shardId, `TRIM_HORIZON`)
let iterator = await kinesis.getShardIterator(dummyStream, shard.id, `TRIM_HORIZON`)

while (true) {
let shouldBreak = false;
while (!shouldBreak) {
const res = await kinesis.getRecords({ ShardIterator: iterator })
iterator = res.NextShardIterator

if (!res.MillisBehindLatest || res.MillisBehindLatest == `0`) {
break
shouldBreak = true
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion examples/s3-multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ export default async function () {
])

// Let's redownload it verify it's correct, and delete it
const obj = await s3.getObject(testBucketName, testFileKey)
await s3.getObject(testBucketName, testFileKey)
await s3.deleteObject(testBucketName, testFileKey)
}
2 changes: 1 addition & 1 deletion examples/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export default async function () {
}

// Let's redownload it, verify it's correct, and delete it
const obj = await s3.getObject(testBucketName, testFileKey)
await s3.getObject(testBucketName, testFileKey)
await s3.deleteObject(testBucketName, testFileKey)
}
2 changes: 1 addition & 1 deletion examples/secrets-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function () {

// Now that we know the secret exist, let's update its value
const newTestSecretValue = 'new-test-value'
const u = await secretsManager.putSecretValue(testSecretName, newTestSecretValue)
await secretsManager.putSecretValue(testSecretName, newTestSecretValue)

// Let's get its value and verify it was indeed updated
const updatedSecret = await secretsManager.getSecret(testSecretName)
Expand Down
1 change: 0 additions & 1 deletion examples/signature-presign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AWSConfig,
SignatureV4,
AMZ_CONTENT_SHA256_HEADER,
UNSIGNED_PAYLOAD,
} from '../build/aws.js'

const awsConfig = new AWSConfig({
Expand Down
Loading
Loading