Added new package @types/artillery (#20779)

* Artillery types for beforeRequest & afterResponse hooks

* Remove unnecessary linting rule in Artillery project

* Update Artillery tests to define variables to ensure proper compilation usage

* Fix compilation errors in test & move typescript decl to line 5
This commit is contained in:
kmccoan-allocadia
2017-10-23 09:45:25 -07:00
committed by Andy
parent f251c61650
commit ba1ed4e100
4 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { ScenarioContext, Next } from 'artillery';
const scenarioContext: ScenarioContext = {vars: {}};
scenarioContext.vars = {};
scenarioContext.vars.testing = "value";
scenarioContext.vars.testing2 = 1;
const next: Next = (error?: Error) => {
// do nothing.
};
next();
next(new Error());

13
types/artillery/index.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// Type definitions for artillery 1.6
// Project: https://github.com/shoreditch-ops/artillery#readme
// Definitions by: Kira McCoan <https://github.com/kmccoan-allocadia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as request from 'request';
import * as events from 'events';
export interface ScenarioContext { vars: {[key: string]: any}; }
export type Next = (err?: Error) => void;
export type ResponseRequest = request.ResponseRequest;
export type RequestResponse = request.RequestResponse;
export type EventEmitter = events.EventEmitter;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"artillery-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}