File tree Expand file tree Collapse file tree 4 files changed +36
-38
lines changed Expand file tree Collapse file tree 4 files changed +36
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ export const url = ( path ) => `${ __ENV . BASE_URL ?? 'http://localhost:3000' } /${ path } ` ;
2+
3+ /** @type {(envVar: string) => boolean } */
4+ const envToBoolean = ( envVar ) => {
5+ const value = __ENV [ envVar ] ;
6+ return ! ! value && [ 'true' , '1' , 'yes' ] . includes ( value . toLowerCase ( ) ) ;
7+ } ;
8+
9+ /** @type {(env?: { isBrowser?: boolean, isDebug?: boolean }) => import('k6/options').Options } */
10+ export const defaultOptions = ( { isBrowser = false , isDebug = envToBoolean ( 'DEBUG_K6' ) } = { } ) => {
11+ const baseOptions = isDebug
12+ ? {
13+ vus : 1 ,
14+ iterations : 1 ,
15+ httpDebug : isBrowser ? undefined : 'full' ,
16+ }
17+ : {
18+ vus : 10 ,
19+ duration : '30s' ,
20+ } ;
21+ return isBrowser
22+ ? {
23+ ...baseOptions ,
24+ executor : 'shared-iterations' ,
25+ options : {
26+ browser : {
27+ type : 'chromium' ,
28+ } ,
29+ } ,
30+ }
31+ : baseOptions ;
32+ } ;
Original file line number Diff line number Diff line change 11import { check } from 'k6' ;
22import http from 'k6/http' ;
3- import { defaultOptions , url } from './_util .js' ;
3+ import { defaultOptions , url } from './lib/util .js' ;
44
5- export const options = defaultOptions ( false ) ;
5+ export const options = defaultOptions ( ) ;
66
77export default ( ) => {
88 const rootUrl = url ( '' ) ;
Original file line number Diff line number Diff line change 11import { check } from 'k6' ;
22import http from 'k6/http' ;
3- import { defaultOptions , url } from './_util .js' ;
3+ import { defaultOptions , url } from './lib/util .js' ;
44
5- export const options = defaultOptions ( false ) ;
5+ export const options = defaultOptions ( ) ;
66
77export default ( ) => {
88 const streamingUrl = url ( 'stream_async_components?delay=5' ) ;
You can’t perform that action at this time.
0 commit comments