-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathscenario-error.js
More file actions
43 lines (37 loc) · 1.06 KB
/
scenario-error.js
File metadata and controls
43 lines (37 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const Sentry = require('@sentry/node');
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
tracesSampleRate: 1.0,
transport: loggingTransport,
});
// Stop the process from exiting before the transaction is sent
setInterval(() => {}, 1000);
async function run() {
const gql = require('graphql-tag');
const server = require('./apollo-server')();
await Sentry.startSpan(
{
name: 'Test Transaction',
op: 'transaction',
},
async span => {
// Ref: https://www.apollographql.com/docs/apollo-server/testing/testing/#testing-using-executeoperation
await server.executeOperation({
query: gql`
mutation Mutation($email: String) {
login(email: $email)
}
`,
// We want to trigger an error by passing an invalid variable type
variables: { email: 123 },
});
setTimeout(() => {
span.end();
server.stop();
}, 500);
},
);
}
run();