Skip to content

Commit 28c4117

Browse files
authored
chore(firestore-stripe-payments): updated scripts for CI and local testing (#415)
* chore(firestore-stripe-payments): updated scripts for ci and local testing * chore(firestore-stripe-payments): added testing typescript configuration, fixes jest warnings in files * fix(firestore-stripe-web-sdk): locked sinon types to 10.0.6 * chore(firestore-stripe-payments): removed obsolete comments
1 parent 2b7c387 commit 28c4117

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

firestore-stripe-payments/functions/__tests__/run-script-watch.ts

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,19 @@ import { setupProxy, cleanupProxy } from './helpers/setupProxy';
55
(async () => {
66
const proxyId = await setupProxy();
77

8-
/* clean stripe webhook on exit */
9-
process.on('SIGINT', () => {
10-
cleanupProxy(proxyId).then(() => {
11-
console.log('Removed webhook ', proxyId);
12-
process.exit(0);
13-
});
14-
});
15-
16-
await concurrently([
17-
{
18-
command: 'npx kill-port 5001, npx kill-port 8080',
19-
name: 'Ready ports',
20-
},
21-
]);
22-
23-
await concurrently(
8+
const { result } = await concurrently(
249
[
2510
{
26-
command: 'npm run start:emulator',
27-
name: 'emulator',
28-
},
29-
{
30-
command: 'sh ../runTestsWatch.sh',
11+
command: 'npm run exec:emulator:watch',
3112
name: 'testing',
3213
},
3314
],
3415
{}
3516
);
17+
18+
await result.then(async () => {
19+
await cleanupProxy(proxyId);
20+
console.log('Removed webhook ', proxyId);
21+
process.exit(0);
22+
});
3623
})();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"lib": ["es2017"],
5+
"types": ["../node_modules/stripe/types/2020-08-27", "jest", "node"],
6+
"rootDir": "./"
7+
},
8+
"include": ["../__tests__"],
9+
"exclude": ["../node_modules"]
10+
}

firestore-stripe-payments/functions/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
"compile": "tsc",
1313
"generate-readme": "firebase ext:info .. --markdown > ../README.md",
1414
"test": "ts-node ./__tests__/run-script.ts",
15-
"test:local": "ts-node ./__tests__/run-script-watch.ts",
16-
"test:watch": "concurrently \"npm run setup:emulator\" \"jest --watch\"",
15+
"test:watch": "ts-node ./__tests__/run-script-watch.ts",
1716
"start:emulator": "cd ../_emulator && firebase emulators:start -P demo-project",
1817
"exec:emulator": "cd ../_emulator && firebase emulators:exec \"../runTests.sh\" -P demo-project",
19-
"setup:webhooks": "ts-node ./__tests__/helpers/setupProxy.ts",
20-
"test-coverage": "jest --coverage --detectOpenHandles --forceExit"
18+
"exec:emulator:watch": "cd ../_emulator && firebase emulators:exec \"../runTestsWatch.sh\" -P demo-project",
19+
"setup:webhooks": "ts-node ./__tests__/helpers/setupProxy.ts"
2120
},
2221
"author": "Stripe (https://stripe.com/)",
2322
"license": "Apache-2.0",

firestore-stripe-payments/runTests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22
cd ../functions
3-
jest
3+
jest --coverage

firestore-stripe-web-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@types/chai-as-promised": "^7.1.4",
3838
"@types/chai-like": "^1.1.1",
3939
"@types/mocha": "^9.0.0",
40-
"@types/sinon": "^10.0.6",
40+
"@types/sinon": "10.0.6",
4141
"@types/sinon-chai": "^3.2.5",
4242
"chai": "^4.3.4",
4343
"chai-as-promised": "^7.1.1",

0 commit comments

Comments
 (0)