forked from sid88in/serverless-appsync-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.integration.setup.ts
More file actions
22 lines (21 loc) · 836 Bytes
/
Copy pathjest.integration.setup.ts
File metadata and controls
22 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
* Jest globalSetup for the integration suite.
*
* Each test scaffolds its own temporary Serverless service and links the plugin
* source itself, so the only global precondition is that the plugin has been
* compiled to `lib/` (the deployed service resolves the plugin from there).
* `npm run test:integration` runs `npm run build` first, so this is just a
* guard with a helpful message.
*/
import * as fs from 'fs';
import * as path from 'path';
export default async function globalSetup(): Promise<void> {
const libPath = path.resolve(__dirname, 'lib', 'index.js');
if (!fs.existsSync(libPath)) {
throw new Error(
`Plugin build artifact not found at ${libPath}. ` +
'Run `npm run build` before the integration suite, or use ' +
'`npm run test:integration` which builds first.',
);
}
}