Skip to main content
Version: 3.0.3

Initialize

Initialize Gentrace with the init() function. This allows other Gentrace SDK functions to transparently authenticate to Gentrace.

Example

Directly passing arguments:

typescript
import { init } from '@gentrace/core';
 
init({
apiKey: process.env.GENTRACE_API_KEY,
resultName: "My Test Result",
branch: "main",
commit: "1234567890"
});

Using environmental variables:

typescript
import { init } from '@gentrace/core';
 
// Environmental variables (e.g. GENTRACE_API_KEY) are expected to available in
// the process environment via a .env file, CI/CD environment primitives, etc.
init();

Arguments

apiKey: string

Create an API key here.

resultName?: string

Learn more about test result names here.

branch?: string

Associate a Git branch with the test result. Create comparative test results here.

commit?: string

Associate a Git commit with the test result. Create comparative test results here.

Environmental variables

You can also set environmental variables rather than directly passing the arguments to the init() function.

$GENTRACE_API_KEY

Replaces the apiKey argument.

$GENTRACE_RESULT_NAME

Replaces the resultName argument.

$GENTRACE_BRANCH

Replaces the branch argument.

$GENTRACE_COMMIT

Replaces the commit argument.