Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions _dev/pm2/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,19 @@ else
pm2 start _dev/pm2/infrastructure.config.js
fi

echo "waiting for containers to start"

_scripts/check-url.sh localhost:4100/health 200 "goaws (SNS)"
_scripts/check-url.sh localhost:9299/api/config 200 "firebase emulator"
echo "Waiting for mysql"
_scripts/check-mysql.sh

echo "Waiting for Redis"
_scripts/check-redis.sh

echo "waiting for DB patches"
_scripts/check-db-patcher.sh

# Check that goaws simulator is up
echo "Waiting for goaws"
_scripts/check-url.sh localhost:4100/health 200 "goaws (SNS)"

# Check firestore is up
echo "Waiting for firestore"
_scripts/check-url.sh localhost:9299/api/config 200 "firebase emulator"
2 changes: 1 addition & 1 deletion apps/payments/api/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
module.exports = {
displayName: 'apiapi',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions apps/payments/next/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* eslint-disable */
import { Config } from 'jest';
import type { Config } from 'jest';

const config: Config = {
displayName: 'payments-next',
Expand All @@ -26,4 +26,4 @@ const config: Config = {
],
};

export default config;
module.exports = config;
24 changes: 14 additions & 10 deletions apps/payments/next/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/payments/next",
"projectType": "application",
"tags": ["app", "payments", "type:sp3"],
"targets": {
"build": {
"dependsOn": ["l10n-bundle", "glean-generate", "payments-metrics:glean-generate-frontend"]
"dependsOn": [
"l10n-bundle",
"glean-generate",
"payments-metrics:glean-generate-frontend"
]
},
"dev": {
"options": {
Expand Down Expand Up @@ -39,7 +44,11 @@
},
"start": {
"command": "pm2 start apps/payments/next/pm2.config.js && yarn check:url localhost:3035/__heartbeat__",
"dependsOn": ["l10n-bundle", "glean-generate", "payments-metrics:glean-generate-frontend"]
"dependsOn": [
"l10n-bundle",
"glean-generate",
"payments-metrics:glean-generate-frontend"
]
},
"stop": {
"command": "pm2 stop apps/payments/next/pm2.config.js"
Expand All @@ -56,9 +65,7 @@
"command": "yarn grunt --gruntfile='apps/payments/next/Gruntfile.js' merge-ftl",
"dependsOn": ["l10n-prime"],
"inputs": ["{projectRoot}/gruntfile.js", "{projectRoot}/app/**/en.ftl"],
"outputs": [
"{projectRoot}/public/locales/en/payments-next.ftl"
]
"outputs": ["{projectRoot}/public/locales/en/payments-next.ftl"]
},
"l10n-prime": {
"command": "./_scripts/l10n/prime.sh apps/payments/next"
Expand All @@ -74,9 +81,7 @@
"{projectRoot}/public/locales/**/payments-next.ftl",
"{projectRoot}/public/locales/**/react.ftl"
],
"outputs": [
"{projectRoot}/public/locales/**/main.ftl"
]
"outputs": ["{projectRoot}/public/locales/**/main.ftl"]
},
"watchers": {
"command": "yarn grunt --gruntfile='apps/payments/next/Gruntfile.js' watchers"
Expand All @@ -99,6 +104,5 @@
"{workspaceRoot}/libs/shared/metrics/glean/src/registry/subplat-backend-metrics.yaml"
]
}
},
"tags": ["app", "payments", "type:sp3"]
}
}
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getJestProjectsAsync } from '@nx/jest';
const { getJestProjectsAsync } = require('@nx/jest');

export default async () => ({
module.exports = async () => ({
projects: await getJestProjectsAsync(),
});
2 changes: 1 addition & 1 deletion libs/accounts/email-renderer/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
export default {
module.exports = {
displayName: 'accounts-email-renderer',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
1 change: 1 addition & 0 deletions libs/accounts/email-renderer/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"test-integration": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"dependsOn": ["l10n-merge"],
"options": {
"jestConfig": "libs/accounts/email-renderer/jest.config.ts",
"testPathPattern": ["\\.in\\.spec\\.ts$"]
Expand Down
2 changes: 1 addition & 1 deletion libs/accounts/email-renderer/src/storybook-email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async function renderUsingMJML({
});
}

const Template: StoryFn<StorybookEmailArgs> = (args, context) =>
const Template: StoryFn<StorybookEmailArgs> = (args:any, context:{globals:{ acceptLanguage:string, direction: "ltr" | "rtl"}}) =>
storybookEmail({
...args,
acceptLanguage: context.globals['acceptLanguage'],
Expand Down
2 changes: 1 addition & 1 deletion libs/accounts/email-renderer/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion libs/accounts/email-sender/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
export default {
module.exports = {
displayName: 'accounts-email-sender',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions libs/accounts/email-sender/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/email-sender/jest.config.ts",
"testPathPattern": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
"testPathPatterns": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
}
},
"test-integration": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/email-sender/jest.config.ts",
"testPathPattern": ["\\.in\\.spec\\.ts$"]
"testPathPatterns": ["\\.in\\.spec\\.ts$"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/accounts/errors/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
export default {
module.exports = {
displayName: 'accounts-errors',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions libs/accounts/errors/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/errors/jest.config.ts",
"testPathPattern": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
"testPathPatterns": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
}
},
"test-integration": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/errors/jest.config.ts",
"testPathPattern": ["\\.in\\.spec\\.ts$"]
"testPathPatterns": ["\\.in\\.spec\\.ts$"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/accounts/oauth/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
module.exports = {
displayName: 'oauth',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions libs/accounts/passkey/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config } from 'jest';
import type { Config } from 'jest';

/* eslint-disable */
const config: Config = {
Expand Down Expand Up @@ -30,4 +30,4 @@ const config: Config = {
: {}),
};

export default config;
module.exports = config;
4 changes: 2 additions & 2 deletions libs/accounts/passkey/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/passkey/jest.config.ts",
"testPathPattern": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
"testPathPatterns": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
}
},
"test-integration": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/passkey/jest.config.ts",
"testPathPattern": ["\\.in\\.spec\\.ts$"]
"testPathPatterns": ["\\.in\\.spec\\.ts$"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion libs/accounts/rate-limit/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
export default {
module.exports = {
displayName: 'accounts-rate-limit',
preset: '../../../jest.preset.js',
testEnvironment: 'node',
Expand Down
4 changes: 2 additions & 2 deletions libs/accounts/rate-limit/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/rate-limit/jest.config.ts",
"testPathPattern": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
"testPathPatterns": ["^(?!.*\\.in\\.spec\\.ts$).*$"]
}
},
"test-integration": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/accounts/rate-limit/jest.config.ts",
"testPathPattern": ["\\.in\\.spec\\.ts$"]
"testPathPatterns": ["\\.in\\.spec\\.ts$"]
}
}
}
Expand Down
30 changes: 15 additions & 15 deletions libs/accounts/rate-limit/src/lib/rate-limit.in.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ describe('rate-limit', () => {
expect(check2?.reason).toEqual('too-many-attempts');
expect(check2?.retryAfter).toEqual(1000);

expect(mockIncrement).toBeCalledTimes(1);
expect(mockIncrement).toBeCalledWith('rate_limit.block', [
expect(mockIncrement).toHaveBeenCalledTimes(1);
expect(mockIncrement).toHaveBeenCalledWith('rate_limit.block', [
`on:${blockOn}`,
'action:testBlock',
]);
Expand Down Expand Up @@ -91,8 +91,8 @@ describe('rate-limit', () => {
expect(check1).toBeNull();
expect(check2).toBeNull();

expect(mockIncrement).toBeCalledTimes(1);
expect(mockIncrement).toBeCalledWith('rate_limit.report', [
expect(mockIncrement).toHaveBeenCalledTimes(1);
expect(mockIncrement).toHaveBeenCalledWith('rate_limit.report', [
`on:${blockOn}`,
'action:testReport',
]);
Expand Down Expand Up @@ -217,7 +217,7 @@ describe('rate-limit', () => {

expect(check1).toBeNull();
expect(check2?.retryAfter).toEqual(1000);
expect(check3?.retryAfter).toBeLessThan(501);
expect(check3?.retryAfter).toBeLessThan(550);
expect(check3?.retryAfter).toBeGreaterThan(450);
expect(check4).toBeNull();
});
Expand Down Expand Up @@ -268,19 +268,19 @@ describe('rate-limit', () => {
expect(checkReportOnly2).toBeNull();
expect(checkReportOnly3).toBeNull();

expect(statsd.increment).toBeCalledTimes(5);
expect(statsd.increment).toHaveBeenCalledTimes(5);
// For unblock calls
expect(statsd.increment).toBeCalledWith('rate_limit.unblock', [
expect(statsd.increment).toHaveBeenCalledWith('rate_limit.unblock', [
'on:ip',
'action:testBlock',
]);
// For two blocked calls
expect(statsd.increment).toBeCalledWith('rate_limit.block', [
expect(statsd.increment).toHaveBeenCalledWith('rate_limit.block', [
'on:ip',
'action:testBlock',
]);
// For two report only calls
expect(statsd.increment).toBeCalledWith('rate_limit.report', [
expect(statsd.increment).toHaveBeenCalledWith('rate_limit.report', [
'on:ip',
'action:testReport',
]);
Expand Down Expand Up @@ -317,8 +317,8 @@ describe('rate-limit', () => {
expect(check2?.reason).toEqual('too-many-attempts');
expect(check2?.retryAfter).toEqual(1000);

expect(mockIncrement).toBeCalledTimes(1);
expect(mockIncrement).toBeCalledWith('rate_limit.block', [
expect(mockIncrement).toHaveBeenCalledTimes(1);
expect(mockIncrement).toHaveBeenCalledWith('rate_limit.block', [
'on:ip',
'action:testBlock',
]);
Expand Down Expand Up @@ -377,8 +377,8 @@ describe('rate-limit', () => {
expect(check4).not.toBeNull();
expect(check5).toBeNull();

expect(statsd.increment).toBeCalledTimes(1);
expect(statsd.increment).toBeCalledWith('rate_limit.ban', [
expect(statsd.increment).toHaveBeenCalledTimes(1);
expect(statsd.increment).toHaveBeenCalledWith('rate_limit.ban', [
'on:ip',
'action:testBan',
]);
Expand Down Expand Up @@ -460,9 +460,9 @@ describe('rate-limit', () => {

expect(check1).toBeNull();
expect(check2?.retryAfter).toEqual(1000);
expect(check3?.retryAfter).toBeLessThan(501);
expect(check3?.retryAfter).toBeLessThan(550);
expect(check3?.retryAfter).toBeGreaterThan(450);
expect(check3b?.retryAfter).toBeLessThan(501);
expect(check3b?.retryAfter).toBeLessThan(550);
expect(check3b?.retryAfter).toBeGreaterThan(450);
expect(check4).toBeNull();
expect(check4b).toBeNull();
Expand Down
Loading
Loading