@grafana/openapi-to-k6 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +31 -0
- package/.github/workflows/publish.yaml +37 -0
- package/.github/workflows/tests.yaml +43 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierrc +10 -0
- package/LICENSE.md +660 -0
- package/README.md +80 -0
- package/dist/analytics.js +80 -0
- package/dist/cli.js +84 -0
- package/dist/constants.js +21 -0
- package/dist/generator.js +57 -0
- package/dist/helper.js +198 -0
- package/dist/k6SdkClient.js +307 -0
- package/dist/logger.js +50 -0
- package/jest.config.js +15 -0
- package/package.json +56 -0
- package/src/analytics.ts +71 -0
- package/src/cli.ts +96 -0
- package/src/constants.ts +19 -0
- package/src/generator.ts +71 -0
- package/src/helper.ts +210 -0
- package/src/k6SdkClient.ts +434 -0
- package/src/logger.ts +61 -0
- package/src/type.d.ts +34 -0
- package/tests/e2e/k6Script.ts +77 -0
- package/tests/e2e/schema.json +289 -0
- package/tests/functional-tests/fixtures/schemas/basic_schema.json +41 -0
- package/tests/functional-tests/fixtures/schemas/form_data_schema.json +94 -0
- package/tests/functional-tests/fixtures/schemas/form_url_encoded_data_schema.json +93 -0
- package/tests/functional-tests/fixtures/schemas/form_url_encoded_data_with_query_params_schema.json +113 -0
- package/tests/functional-tests/fixtures/schemas/get_request_with_path_parameters_schema.json +66 -0
- package/tests/functional-tests/fixtures/schemas/headers_schema.json +163 -0
- package/tests/functional-tests/fixtures/schemas/no_title_schema.json +40 -0
- package/tests/functional-tests/fixtures/schemas/post_request_with_query_params.json +95 -0
- package/tests/functional-tests/fixtures/schemas/query_params_schema.json +115 -0
- package/tests/functional-tests/fixtures/schemas/simple_post_request_schema.json +132 -0
- package/tests/functional-tests/generator.test.ts +73 -0
- package/tests/helper.test.ts +203 -0
- package/tsconfig.json +17 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es6": true,
|
|
4
|
+
"node": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
9
|
+
"plugin:@typescript-eslint/recommended",
|
|
10
|
+
"plugin:import/recommended",
|
|
11
|
+
"plugin:import/typescript",
|
|
12
|
+
"prettier"
|
|
13
|
+
],
|
|
14
|
+
"parser": "@typescript-eslint/parser",
|
|
15
|
+
"plugins": ["import", "unused-imports"],
|
|
16
|
+
"settings": {
|
|
17
|
+
"import/resolver": {
|
|
18
|
+
"typescript": {}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"rules": {
|
|
22
|
+
"no-param-reassign": "error",
|
|
23
|
+
"@typescript-eslint/no-unused-vars": [
|
|
24
|
+
"error",
|
|
25
|
+
{
|
|
26
|
+
"varsIgnorePattern": "^_",
|
|
27
|
+
"argsIgnorePattern": "^_"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Publish Package to GitHub Packages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types:
|
|
6
|
+
- created
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0 # Fetch all history for all branches and tags
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: '21'
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
21
|
+
scope: '@grafana'
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- name: Update version in package.json
|
|
24
|
+
run: |
|
|
25
|
+
NEW_VERSION=${{ github.event.release.tag_name }}
|
|
26
|
+
npm version $NEW_VERSION --no-git-tag-version
|
|
27
|
+
- name: Commit updated package.json
|
|
28
|
+
run: |
|
|
29
|
+
git config --global user.name 'github-actions[bot]'
|
|
30
|
+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
31
|
+
git add package.json package-lock.json
|
|
32
|
+
git commit -m "Update package.json version to ${{ github.event.release.tag_name }}"
|
|
33
|
+
git push origin HEAD:main
|
|
34
|
+
- run: npm run build
|
|
35
|
+
- run: npm publish --access public
|
|
36
|
+
env:
|
|
37
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-node@v4
|
|
17
|
+
with:
|
|
18
|
+
node-version: '21.5.0'
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run lint
|
|
21
|
+
- run: npm test
|
|
22
|
+
e2e-test:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: '21.5.0'
|
|
29
|
+
- run: npm ci
|
|
30
|
+
- name: Generate SDK for E2E tests
|
|
31
|
+
run: npm run dev -- ./tests/e2e/schema.json ./tests/e2e/sdk.ts --disable-analytics
|
|
32
|
+
- name: Start Mockoon CLI
|
|
33
|
+
uses: mockoon/cli-action@v2
|
|
34
|
+
with:
|
|
35
|
+
# Mockoon local data file or URL
|
|
36
|
+
data-file: './tests/e2e/schema.json'
|
|
37
|
+
port: 3000
|
|
38
|
+
- uses: grafana/setup-k6-action@v1
|
|
39
|
+
- uses: grafana/run-k6-action@v1
|
|
40
|
+
with:
|
|
41
|
+
path: './tests/e2e/k6Script.ts'
|
|
42
|
+
flags: '--compatibility-mode=experimental_enhanced'
|
|
43
|
+
inspect-flags: '--compatibility-mode=experimental_enhanced'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v20
|