@grafana/openapi-to-k6 0.2.1 → 0.2.3
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/.github/workflows/publish.yaml +2 -0
- package/examples/basic_schema/single/simpleAPI.ts +1 -1
- package/examples/basic_schema/split/simpleAPI.schemas.ts +1 -1
- package/examples/basic_schema/split/simpleAPI.ts +1 -1
- package/examples/basic_schema/tags/default.ts +1 -1
- package/examples/basic_schema/tags/simpleAPI.schemas.ts +1 -1
- package/examples/form_data_schema/single/formDataAPI.ts +1 -1
- package/examples/form_data_schema/split/formDataAPI.schemas.ts +1 -1
- package/examples/form_data_schema/split/formDataAPI.ts +1 -1
- package/examples/form_data_schema/tags/default.ts +1 -1
- package/examples/form_data_schema/tags/formDataAPI.schemas.ts +1 -1
- package/examples/form_url_encoded_data_schema/single/formURLEncodedAPI.ts +1 -1
- package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.schemas.ts +1 -1
- package/examples/form_url_encoded_data_schema/split/formURLEncodedAPI.ts +1 -1
- package/examples/form_url_encoded_data_schema/tags/default.ts +1 -1
- package/examples/form_url_encoded_data_schema/tags/formURLEncodedAPI.schemas.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/single/formURLEncodedAPIWithQueryParameters.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/split/formURLEncodedAPIWithQueryParameters.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/tags/default.ts +1 -1
- package/examples/form_url_encoded_data_with_query_params_schema/tags/formURLEncodedAPIWithQueryParameters.schemas.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/single/simpleAPI.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/split/simpleAPI.schemas.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/split/simpleAPI.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/tags/default.ts +1 -1
- package/examples/get_request_with_path_parameters_schema/tags/simpleAPI.schemas.ts +1 -1
- package/examples/headers_schema/single/headerDemoAPI.ts +1 -1
- package/examples/headers_schema/split/headerDemoAPI.schemas.ts +1 -1
- package/examples/headers_schema/split/headerDemoAPI.ts +1 -1
- package/examples/headers_schema/tags/default.ts +1 -1
- package/examples/headers_schema/tags/headerDemoAPI.schemas.ts +1 -1
- package/examples/no_title_schema/single/k6Client.ts +1 -1
- package/examples/no_title_schema/split/k6Client.schemas.ts +1 -1
- package/examples/no_title_schema/split/k6Client.ts +1 -1
- package/examples/no_title_schema/tags/default.ts +1 -1
- package/examples/no_title_schema/tags/k6Client.schemas.ts +1 -1
- package/examples/post_request_with_query_params/single/exampleAPI.ts +1 -1
- package/examples/post_request_with_query_params/split/exampleAPI.schemas.ts +1 -1
- package/examples/post_request_with_query_params/split/exampleAPI.ts +1 -1
- package/examples/post_request_with_query_params/tags/default.ts +1 -1
- package/examples/post_request_with_query_params/tags/exampleAPI.schemas.ts +1 -1
- package/examples/query_params_schema/single/exampleAPI.ts +1 -1
- package/examples/query_params_schema/split/exampleAPI.schemas.ts +1 -1
- package/examples/query_params_schema/split/exampleAPI.ts +1 -1
- package/examples/query_params_schema/tags/default.ts +1 -1
- package/examples/query_params_schema/tags/exampleAPI.schemas.ts +1 -1
- package/examples/simple_post_request_schema/single/exampleAPI.ts +1 -1
- package/examples/simple_post_request_schema/split/exampleAPI.schemas.ts +1 -1
- package/examples/simple_post_request_schema/split/exampleAPI.ts +1 -1
- package/examples/simple_post_request_schema/tags/default.ts +1 -1
- package/examples/simple_post_request_schema/tags/exampleAPI.schemas.ts +1 -1
- package/package.json +6 -7
- package/tests/functional-tests/generator.test.ts +9 -0
- package/tests/helper.test.ts +13 -6
- package/vite.config.js +13 -0
- package/jest.config.js +0 -16
|
@@ -26,6 +26,8 @@ jobs:
|
|
|
26
26
|
run: |
|
|
27
27
|
NEW_VERSION=${{ github.event.release.tag_name }}
|
|
28
28
|
npm version $NEW_VERSION --no-git-tag-version
|
|
29
|
+
- name: Update generated examples
|
|
30
|
+
run: npm run update-examples
|
|
29
31
|
- name: Commit updated package.json
|
|
30
32
|
run: |
|
|
31
33
|
git config --global user.name 'github-actions[bot]'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/openapi-to-k6",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A CLI tool to generate helper modules for K6 from OpenAPI schema",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"dev": "DISABLE_ANALYTICS=true ts-node src/cli.ts",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "vitest run --coverage",
|
|
13
13
|
"lint": "eslint --ext .ts,.tsx .",
|
|
14
14
|
"lint:fix": "eslint --ext .ts,.tsx . --fix",
|
|
15
15
|
"format": "prettier --ignore-unknown --write \"./**/*\"",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"commander": "^12.1.0",
|
|
26
26
|
"handlebars": "^4.7.8",
|
|
27
27
|
"openapi-typescript": "^7.4.1",
|
|
28
|
-
"orval": "^7.
|
|
28
|
+
"orval": "^7.2.0",
|
|
29
29
|
"prettier": "^3.3.3",
|
|
30
30
|
"uuid": "^10.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@types/jest": "^29.5.13",
|
|
34
33
|
"@types/uuid": "^10.0.0",
|
|
35
34
|
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
35
|
+
"@vitest/coverage-v8": "^2.1.3",
|
|
36
36
|
"eslint": "^8.57.0",
|
|
37
37
|
"eslint-config-prettier": "^9.1.0",
|
|
38
38
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
@@ -40,12 +40,11 @@
|
|
|
40
40
|
"eslint-plugin-prettier": "^5.2.1",
|
|
41
41
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
42
42
|
"husky": "^9.1.6",
|
|
43
|
-
"jest": "^29.7.0",
|
|
44
43
|
"lint-staged": "^15.2.10",
|
|
45
44
|
"prettier": "^3.3.3",
|
|
46
|
-
"ts-jest": "^29.2.5",
|
|
47
45
|
"ts-node": "^10.9.2",
|
|
48
|
-
"typescript": "^5.6.2"
|
|
46
|
+
"typescript": "^5.6.2",
|
|
47
|
+
"vitest": "^2.1.3"
|
|
49
48
|
},
|
|
50
49
|
"lint-staged": {
|
|
51
50
|
"*.{js,jsx,ts,tsx}": [
|
|
@@ -2,6 +2,15 @@ import fs from 'fs'
|
|
|
2
2
|
import os from 'os'
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import { promisify } from 'util'
|
|
5
|
+
import {
|
|
6
|
+
afterAll,
|
|
7
|
+
afterEach,
|
|
8
|
+
beforeAll,
|
|
9
|
+
beforeEach,
|
|
10
|
+
describe,
|
|
11
|
+
expect,
|
|
12
|
+
it,
|
|
13
|
+
} from 'vitest'
|
|
5
14
|
import { Mode } from '../../src/constants'
|
|
6
15
|
import generator from '../../src/generator'
|
|
7
16
|
|
package/tests/helper.test.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import os from 'os'
|
|
3
3
|
import path from 'path'
|
|
4
|
+
import {
|
|
5
|
+
afterAll,
|
|
6
|
+
beforeAll,
|
|
7
|
+
beforeEach,
|
|
8
|
+
describe,
|
|
9
|
+
expect,
|
|
10
|
+
it,
|
|
11
|
+
vi,
|
|
12
|
+
} from 'vitest'
|
|
4
13
|
import * as helper from '../src/helper'
|
|
5
14
|
import { PackageDetails } from '../src/type'
|
|
6
15
|
|
|
7
16
|
// Mock the package.json file
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
() => ({
|
|
17
|
+
vi.mock('../package.json', () => ({
|
|
18
|
+
default: {
|
|
11
19
|
name: 'test-package-name',
|
|
12
20
|
description: 'This is a test package',
|
|
13
21
|
bin: { 'test-package': 'bin/test-package.js' },
|
|
14
22
|
version: '1.0.0',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
)
|
|
23
|
+
},
|
|
24
|
+
}))
|
|
18
25
|
|
|
19
26
|
describe('getPackageDetails', () => {
|
|
20
27
|
it('should return the package details', () => {
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
environment: 'node',
|
|
6
|
+
coverage: {
|
|
7
|
+
reporter: ['json', 'text', 'lcov'],
|
|
8
|
+
reportsDirectory: 'coverage',
|
|
9
|
+
include: ['src/**/*'],
|
|
10
|
+
exclude: ['/node_modules/', '/src/logger.ts'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
})
|
package/jest.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: 'ts-jest',
|
|
3
|
-
testEnvironment: 'node',
|
|
4
|
-
collectCoverage: true,
|
|
5
|
-
coveragePathIgnorePatterns: ['/node_modules/', '/src/logger.ts'],
|
|
6
|
-
coverageDirectory: 'coverage',
|
|
7
|
-
coverageReporters: ['json', 'text', 'lcov'],
|
|
8
|
-
transform: {
|
|
9
|
-
'^.+\\.ts?$': [
|
|
10
|
-
'ts-jest',
|
|
11
|
-
{
|
|
12
|
-
tsconfig: 'tsconfig.json',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
}
|