alsatian
- Version 3.2.1
- Published
- 163 kB
- 11 dependencies
- MIT license
Install
npm i alsatian
yarn add alsatian
pnpm add alsatian
Overview
TypeScript and JavaScript testing framework for beautiful and readable tests
Index
Variables
Functions
Classes
Interfaces
Enums
Type Aliases
Namespaces
Variables
Functions
function Any
Any: { <ExpectedType extends object>(): InterfaceMatcher<ExpectedType>; <ExpectedType extends object>( type: Constructor<ExpectedType> ): MatcherOrType<ExpectedType>;};
function AsyncSetup
AsyncSetup: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function AsyncSetupFixture
AsyncSetupFixture: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function AsyncTeardown
AsyncTeardown: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function AsyncTeardownFixture
AsyncTeardownFixture: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function AsyncTest
AsyncTest: ( description?: string) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>) => void;
function buildExpect
buildExpect: () => IExpect;
function createFunctionSpy
createFunctionSpy: { <FunctionType extends TypedFunction>(): ISpiedFunction<FunctionType>; <ArgumentType, ReturnType>(): ISpiedFunction< (...args: ArgumentType[]) => ReturnType >;};
function Focus
Focus: ( target: object | (new (...args: Array<any>) => object), propertyKey?: string | symbol) => void;
function FocusTest
FocusTest: ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
function FocusTests
FocusTests: (constructor: Constructor) => void;
function Ignore
Ignore: <T>( reason: string) => ( target: T | (new (...args: any[]) => T), propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<T>) => void;
function IgnoreTest
IgnoreTest: ( reason?: string) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
function IgnoreTests
IgnoreTests: (reason?: string) => (constructor: Constructor<object>) => void;
function Setup
Setup: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function SetupFixture
SetupFixture: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function SpyOn
SpyOn: <ObjectType>( target: ObjectType, functionName: keyof ObjectType) => RestorableFunctionSpy;
function SpyOnProperty
SpyOnProperty: <PropertyType>( target: any, propertyName: string) => PropertySpy<PropertyType>;
function Teardown
Teardown: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function TeardownFixture
TeardownFixture: ( target: object, decoratedPropertyKey: string, descriptor?: TypedPropertyDescriptor<() => any>) => void;
function Test
Test: ( description?: string) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
function TestCase
TestCase: ( ...testCaseArguments: Array<any>) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
function TestCases
TestCases: ( caseArguments: | (() => IterableIterator<any> | Array<Array<any>>) | IterableIterator<any> | Array<Array<any>>) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
function TestFixture
TestFixture: ( description?: string) => (constructor: Constructor<object>) => void;
function Timeout
Timeout: ( timeoutInMs: number) => ( target: object, propertyKey: string, descriptor?: TypedPropertyDescriptor<any>) => void;
Classes
class ContainerMatcher
class ContainerMatcher< ContainerType extends { indexOf(content: ContentType): number; }, ContentType> extends ObjectMatcher<ContainerType> {}
method toContain
toContain: (expectedContent: ContentType) => void;
class EmptyMatcher
class EmptyMatcher<T> extends Matcher<T> {}
method toBeEmpty
toBeEmpty: () => void;
class FunctionMatcher
class FunctionMatcher<T extends AnyFunction> extends Matcher<FunctionSpy | T> {}
method toHaveBeenCalled
toHaveBeenCalled: () => FunctionSpyMatcher;
method toHaveBeenCalledWith
toHaveBeenCalledWith: ( ...expectedArguments: Parameters<T>) => FunctionSpyMatcher;
method toThrow
toThrow: () => void;
method toThrowAsync
toThrowAsync: () => Promise<void>;
method toThrowError
toThrowError: ( errorType: new (...args: Array<any>) => Error, errorMessage: string) => void;
method toThrowErrorAsync
toThrowErrorAsync: ( errorType: new (...args: Array<any>) => Error, errorMessage: string) => Promise<void>;
class FunctionSpy
class FunctionSpy {}
property calls
readonly calls: ISpyCall[];
property context
protected context: any;
property hasReturnValue
protected hasReturnValue: boolean;
property isStubbed
protected isStubbed: boolean;
property returnValue
protected returnValue: any;
method andCall
andCall: (fakeFunction: () => any) => void;
method andReturn
andReturn: (returnValue: any) => void;
method call
call: (...args: Array<any>) => any;
method callsWithArguments
callsWithArguments: (...args: Array<any>) => Array<ISpyCall>;
class FunctionSpyMatcher
class FunctionSpyMatcher {}
constructor
constructor(spy: FunctionSpy, expectedArguments?: any[]);
method anythingBut
anythingBut: (unexpectedCallCount: number) => FunctionSpyCallCountMatcher;
method exactly
exactly: (expectedCallCount: number) => FunctionSpyCallCountMatcher;
method greaterThan
greaterThan: (minimumCallCount: number) => FunctionSpyCallCountMatcher;
method lessThan
lessThan: (maximumCallCount: number) => FunctionSpyCallCountMatcher;
class Matcher
class Matcher<T> {}
constructor
constructor(actualValue: {});
property actualValue
readonly actualValue: {};
property not
readonly not: Matcher<T>;
property shouldMatch
readonly shouldMatch: boolean;
method toBe
toBe: (expectedValue: T) => void;
method toBeDefined
toBeDefined: () => void;
method toBeNull
toBeNull: () => void;
method toBeTruthy
toBeTruthy: () => void;
method toEqual
toEqual: (expectedValue: any) => void;
class MatchError
class MatchError extends ExtendoError {}
constructor
constructor( message?: string, expectedValue?: any, actualValue?: any, extras?: { [prop: string]: any });
property actual
readonly actual: any;
property expected
readonly expected: any;
property extras
readonly extras: { [prop: string]: any };
class NumberMatcher
class NumberMatcher extends Matcher<number> {}
method toBeGreaterThan
toBeGreaterThan: (lowerLimit: number) => void;
method toBeLessThan
toBeLessThan: (upperLimit: number) => void;
class PropertyMatcher
class PropertyMatcher<PropertyType> extends Matcher<PropertySpy<PropertyType>> {}
method toHaveBeenSet
toHaveBeenSet: () => void;
method toHaveBeenSetTo
toHaveBeenSetTo: (value: PropertyType) => void;
class RestorableFunctionSpy
class RestorableFunctionSpy extends FunctionSpy {}
constructor
constructor(target: any, functionName: string);
method andCallThrough
andCallThrough: () => void;
method andStub
andStub: () => void;
method call
call: (...args: Array<any>) => any;
method restore
restore: () => void;
class StringMatcher
class StringMatcher extends EmptyMatcher<string> {}
class TestCaseResult
class TestCaseResult implements IResultWithOutcome {}
constructor
constructor(testResults: TestResults, args: any[], error?: Error);
property args
readonly args: any[];
property description
readonly description: string;
property error
readonly error: Error;
property logs
readonly logs: ILog[];
property outcome
readonly outcome: TestOutcome;
property testResults
readonly testResults: TestResults;
class TestFixtureResults
class TestFixtureResults implements IResultWithOutcome {}
constructor
constructor(_testFixture: ITestFixture);
property fixture
readonly fixture: ITestFixture;
property outcome
readonly outcome: TestOutcome;
property testResults
readonly testResults: TestResults[];
method addTestResult
addTestResult: (test: ITest) => TestResults;
class TestOutputStream
class TestOutputStream extends ReadableStream {}
method emitFixture
emitFixture: (fixture: ITestFixture) => void;
method emitLog
emitLog: (...logs: Array<string>) => void;
method emitPlan
emitPlan: (testCount: number) => void;
method emitResult
emitResult: (testId: number, result: TestCaseResult) => void;
method emitVersion
emitVersion: () => void;
method emitWarning
emitWarning: (...warnings: Array<string>) => void;
method end
end: () => void;
class TestResults
class TestResults implements IResultWithOutcome {}
constructor
constructor(fixtureResult: TestFixtureResults, test: ITest);
property fixtureResult
readonly fixtureResult: TestFixtureResults;
property outcome
readonly outcome: TestOutcome;
property test
readonly test: ITest;
method addTestCaseResult
addTestCaseResult: (args: Array<any>, error?: Error | null) => TestCaseResult;
class TestRunner
class TestRunner {}
constructor
constructor(outputStream?: TestOutputStream);
property outputStream
readonly outputStream: TestOutputStream;
method onTestComplete
onTestComplete: (testCompleteCB: IOnTestCompleteCBFunction) => void;
method run
run: (testSet: TestSet, timeout?: number | null) => Promise<void>;
class TestSet
class TestSet {}
constructor
constructor(testLoader: TestLoader, globHelper: GlobHelper);
property testFixtures
readonly testFixtures: ITestFixture[];
method addTestsFromFiles
addTestsFromFiles: (testsFileLocations: string | Array<string>) => void;
method create
static create: () => TestSet;
class TestSetResults
class TestSetResults implements IResultWithOutcome {}
property outcome
readonly outcome: TestOutcome;
property testFixtureResults
readonly testFixtureResults: TestFixtureResults[];
method addTestFixtureResult
addTestFixtureResult: (testFixture: ITestFixture) => TestFixtureResults;
class TestTimeoutError
class TestTimeoutError extends MatchError {}
constructor
constructor(testTimeout: number);
Interfaces
interface IExpect
interface IExpect {}
method extend
extend: <ExpectedType, MatcherType extends Matcher<ExpectedType>>( type: new (...args: Array<any>) => ExpectedType, matcher: new (value: ExpectedType, testItem: any) => MatcherType) => IExtendedExpect<ExpectedType, MatcherType> & this;
method fail
fail: (message: string) => void;
call signature
<T>(actualValue: Array<T>): ContainerMatcher<Array<T>, T>;
call signature
<T extends AnyFunction>(actualValue: FunctionSpy | T): FunctionMatcher<T>;
call signature
(actualValue: number): NumberMatcher;
call signature
<T>(actualValue: PropertySpy<T>): PropertyMatcher<T>;
call signature
(actualValue: object): EmptyMatcher<object>;
call signature
(actualValue: string): StringMatcher;
call signature
<T>(actualValue: T): Matcher<T>;
Enums
enum TestOutcome
enum TestOutcome { Error = 0, Fail = 1, Pass = 2, Skip = 3,}
Type Aliases
type ISpiedFunction
type ISpiedFunction<T extends TypedFunction> = T & FunctionSpy;
Namespaces
namespace METADATA_KEYS
module 'dist/core/decorators/_metadata-keys.d.ts' {}
variable FOCUS
const FOCUS: string;
variable IGNORE
const IGNORE: string;
variable IGNORE_REASON
const IGNORE_REASON: string;
variable SETUP
const SETUP: string;
variable SETUP_FIXTURE
const SETUP_FIXTURE: string;
variable TEARDOWN
const TEARDOWN: string;
variable TEARDOWN_FIXTURE
const TEARDOWN_FIXTURE: string;
variable TEST_CASES
const TEST_CASES: string;
variable TEST_FIXTURE
const TEST_FIXTURE: string;
variable TESTS
const TESTS: string;
variable TIMEOUT
const TIMEOUT: string;
Package Files (50)
- dist/core/alsatian-core.d.ts
- dist/core/decorators/_metadata-keys.d.ts
- dist/core/decorators/async-setup-decorator.d.ts
- dist/core/decorators/async-setup-fixture-decorator.d.ts
- dist/core/decorators/async-teardown-decorator.d.ts
- dist/core/decorators/async-teardown-fixture-decorator.d.ts
- dist/core/decorators/async-test-decorator.d.ts
- dist/core/decorators/focus-decorator.d.ts
- dist/core/decorators/focus-test-decorator.d.ts
- dist/core/decorators/focus-tests-decorator.d.ts
- dist/core/decorators/ignore-decorator.d.ts
- dist/core/decorators/ignore-test-decorator.d.ts
- dist/core/decorators/ignore-tests-decorator.d.ts
- dist/core/decorators/setup-decorator.d.ts
- dist/core/decorators/setup-fixture-decorator.d.ts
- dist/core/decorators/teardown-decorator.d.ts
- dist/core/decorators/teardown-fixture-decorator.d.ts
- dist/core/decorators/test-case-decorator.d.ts
- dist/core/decorators/test-cases-decorator.d.ts
- dist/core/decorators/test-decorator.d.ts
- dist/core/decorators/test-fixture-decorator.d.ts
- dist/core/decorators/timeout-decorator.d.ts
- dist/core/errors/match-error.d.ts
- dist/core/errors/test-timeout-error.d.ts
- dist/core/expect/build-expect.d.ts
- dist/core/expect/expect.d.ts
- dist/core/expect/expect.i.d.ts
- dist/core/matchers/container-matcher.d.ts
- dist/core/matchers/empty-matcher.d.ts
- dist/core/matchers/function-matcher.d.ts
- dist/core/matchers/function-spy-matcher.d.ts
- dist/core/matchers/matcher.d.ts
- dist/core/matchers/number-matcher.d.ts
- dist/core/matchers/property-matcher.d.ts
- dist/core/matchers/string-matcher.d.ts
- dist/core/results/test-case-result.d.ts
- dist/core/results/test-fixture-results.d.ts
- dist/core/results/test-outcome.d.ts
- dist/core/results/test-results.d.ts
- dist/core/results/test-set-results.d.ts
- dist/core/running/test-runner.d.ts
- dist/core/spying/any-argument.d.ts
- dist/core/spying/create-function-spy.d.ts
- dist/core/spying/function-spy.d.ts
- dist/core/spying/restorable-function-spy.d.ts
- dist/core/spying/spied-function.i.d.ts
- dist/core/spying/spy-on-property.d.ts
- dist/core/spying/spy-on.d.ts
- dist/core/test-output-stream.d.ts
- dist/core/test-set.d.ts
Dependencies (11)
Dev Dependencies (18)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/alsatian
.
- Markdown[](https://www.jsdocs.io/package/alsatian)
- HTML<a href="https://www.jsdocs.io/package/alsatian"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6065 ms. - Missing or incorrect documentation? Open an issue for this package.