declapract-typescript-ehmpathy 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/practices/artifact/best-practice/.declapract.readme.md +6 -0
- package/dist/practices/artifact/best-practice/artifact.yml +7 -0
- package/dist/practices/artifact/best-practice/package.json +8 -0
- package/dist/practices/artifact/best-practice/package.json.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-package/best-practice/.github/workflows/publish-on-tag.yml +1 -0
- package/dist/practices/git/best-practice/.gitignore.declapract.ts +1 -0
- package/dist/practices/linting/best-practice/.eslintrc.js +1 -1
- package/dist/practices/persist-with-dynamodb/best-practice/package.json +7 -1
- package/dist/practices/persist-with-dynamodb/best-practice/provision/docker/integration-test-db/docker-compose.yml +9 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/{integration_test_db → integration-test-db}/build-image.dockerfile +0 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/{integration_test_db → integration-test-db}/docker-compose.yml +0 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/{integration_test_db → integration-test-db}/init/.gitignore +0 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/{integration_test_db → integration-test-db}/init/readme.md +0 -0
- package/dist/practices/persist-with-rds/best-practice/provision/docker/{integration_test_db → integration-test-db}/wait-for-postgres.sh +0 -0
- package/dist/practices/serverless/best-practice/serverless.yml +3 -0
- package/dist/practices/terraform/best-practice/provision/aws/environments/test/main.tf +4 -0
- package/dist/practices/testing/best-practice/jest.acceptance.config.ts +17 -0
- package/dist/practices/testing/best-practice/{jest.acceptance.env.js → jest.acceptance.env.ts} +0 -0
- package/dist/practices/testing/best-practice/jest.config.ts +4 -0
- package/dist/practices/testing/best-practice/jest.integration.config.ts +17 -0
- package/dist/practices/testing/best-practice/{jest.integration.env.js → jest.integration.env.ts} +10 -5
- package/dist/practices/testing/best-practice/jest.unit.config.ts +22 -0
- package/dist/practices/testing/best-practice/{jest.unit.env.js → jest.unit.env.ts} +1 -5
- package/dist/practices/testing/best-practice/package.json +4 -4
- package/dist/practices/typescript/best-practice/package.json +1 -1
- package/dist/practices/typescript/best-practice/tsconfig.json +3 -1
- package/package.json +1 -1
- package/dist/practices/testing/best-practice/jest.acceptance.config.js +0 -15
- package/dist/practices/testing/best-practice/jest.config.js +0 -1
- package/dist/practices/testing/best-practice/jest.integration.config.js +0 -10
- package/dist/practices/testing/best-practice/jest.unit.config.js +0 -15
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
trace:
|
|
2
|
+
- 'dist/contract/handlers/**/*.js' # include all dependencies of the handlers
|
|
3
|
+
|
|
4
|
+
pick:
|
|
5
|
+
- 'dist/**/*.js.map' # include all of the source maps # TODO: update simple-artifact-builder to do this automatically for all files it includes
|
|
6
|
+
- 'config/*'
|
|
7
|
+
- 'package.json'
|
|
@@ -2,8 +2,8 @@ module.exports = {
|
|
|
2
2
|
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
|
|
3
3
|
extends: [
|
|
4
4
|
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
|
|
5
|
+
'plugin:import/recommended', // specifies good import rules
|
|
5
6
|
'airbnb-typescript/base', // uses the airbnb recommended rules
|
|
6
|
-
'prettier/@typescript-eslint', // disables ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
|
|
7
7
|
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
|
|
8
8
|
],
|
|
9
9
|
parserOptions: {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"simple-dynamodb-client": "@declapract{check.minVersion('
|
|
3
|
+
"simple-dynamodb-client": "@declapract{check.minVersion('0.10.0')}"
|
|
4
|
+
},
|
|
5
|
+
"scripts": {
|
|
6
|
+
"provision:docker:up": "docker-compose -f ./provision/docker/integration_test_db/docker-compose.yml up -d --force-recreate --build --renew-anon-volumes",
|
|
7
|
+
"provision:docker:down": "docker-compose -f ./provision/docker/integration_test_db/docker-compose.yml down",
|
|
8
|
+
"provision:dynamodb:schema": "terraform -chdir=provision/aws/environments/test apply -auto-approve",
|
|
9
|
+
"provision:integration-test-db": "npm run provision:docker:up && npm run provision:dynamodb:schema"
|
|
4
10
|
}
|
|
5
11
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
|
|
3
|
+
// https://jestjs.io/docs/configuration
|
|
4
|
+
const config: Config = {
|
|
5
|
+
verbose: true,
|
|
6
|
+
testEnvironment: 'node',
|
|
7
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.[tj]sx?$': 'ts-jest', // https://kulshekhar.github.io/ts-jest/docs/getting-started/presets
|
|
10
|
+
},
|
|
11
|
+
testMatch: ['**/*.acceptance.test.ts'],
|
|
12
|
+
setupFiles: ['core-js'],
|
|
13
|
+
setupFilesAfterEnv: ['./jest.acceptance.env.ts'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line import/no-default-export
|
|
17
|
+
export default config;
|
package/dist/practices/testing/best-practice/{jest.acceptance.env.js → jest.acceptance.env.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
|
|
3
|
+
// https://jestjs.io/docs/configuration
|
|
4
|
+
const config: Config = {
|
|
5
|
+
verbose: true,
|
|
6
|
+
testEnvironment: 'node',
|
|
7
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.[tj]sx?$': 'ts-jest', // https://kulshekhar.github.io/ts-jest/docs/getting-started/presets
|
|
10
|
+
},
|
|
11
|
+
testMatch: ['**/*.integration.test.ts'],
|
|
12
|
+
setupFiles: ['core-js'],
|
|
13
|
+
setupFilesAfterEnv: ['./jest.integration.env.ts'],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line import/no-default-export
|
|
17
|
+
export default config;
|
package/dist/practices/testing/best-practice/{jest.integration.env.js → jest.integration.env.ts}
RENAMED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { stage, Stage } from './src/utils/environment';
|
|
2
|
+
|
|
3
|
+
// set a longer timeout
|
|
4
|
+
// eslint-disable-next-line no-undef
|
|
5
|
+
jest.setTimeout(90000); // since we're calling downstream apis
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* sanity check that integration tests are only run in 'test' environment
|
|
@@ -8,6 +11,8 @@ const { stage, Stage } = require('./src/utils/environment');
|
|
|
8
11
|
if (stage !== Stage.TEST && process.env.I_KNOW_WHAT_IM_DOING !== 'true')
|
|
9
12
|
throw new Error(`integration-test is not targeting stage 'test'`);
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* specify that dynamodb should use the local dynamodb database, if running in test env
|
|
16
|
+
*/
|
|
17
|
+
if (stage === Stage.TEST)
|
|
18
|
+
process.env.USE_CUSTOM_DYNAMODB_ENDPOINT = 'http://localhost:7337';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Config } from 'jest';
|
|
2
|
+
|
|
3
|
+
// https://jestjs.io/docs/configuration
|
|
4
|
+
const config: Config = {
|
|
5
|
+
verbose: true,
|
|
6
|
+
testEnvironment: 'node',
|
|
7
|
+
moduleFileExtensions: ['js', 'ts'],
|
|
8
|
+
transform: {
|
|
9
|
+
'^.+\\.[tj]sx?$': 'ts-jest', // https://kulshekhar.github.io/ts-jest/docs/getting-started/presets
|
|
10
|
+
},
|
|
11
|
+
testMatch: [
|
|
12
|
+
// note: order matters
|
|
13
|
+
'**/*.test.ts',
|
|
14
|
+
'!**/*.acceptance.test.ts',
|
|
15
|
+
'!**/*.integration.test.ts',
|
|
16
|
+
],
|
|
17
|
+
setupFiles: ['core-js'],
|
|
18
|
+
setupFilesAfterEnv: ['./jest.unit.env.ts'],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line import/no-default-export
|
|
22
|
+
export default config;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
3
|
-
const { stage, Stage } = require('./src/utils/environment');
|
|
1
|
+
import { stage, Stage } from './src/utils/environment';
|
|
4
2
|
|
|
5
|
-
// eslint-disable-next-line no-undef
|
|
6
3
|
jest.mock('./src/utils/config/getConfig', () => ({
|
|
7
|
-
// eslint-disable-next-line no-undef
|
|
8
4
|
getConfig: jest.fn().mockImplementation(() => require('./config/test.json')), // mock that getConfig just returns plaintext test env config in unit tests
|
|
9
5
|
}));
|
|
10
6
|
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"simple-lambda-testing-methods": "@declapract{check.minVersion('0.2.1')}"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"test:unit": "jest -c ./jest.unit.config.
|
|
11
|
-
"test:integration": "jest -c ./jest.integration.config.
|
|
12
|
-
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.
|
|
10
|
+
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --coverage --verbose --passWithNoTests",
|
|
11
|
+
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --coverage --verbose --passWithNoTests",
|
|
12
|
+
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand",
|
|
13
13
|
"test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
14
|
-
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.
|
|
14
|
+
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build:clean": "rm dist/ -rf",
|
|
8
8
|
"build:compile": "tsc -p ./tsconfig.build.json",
|
|
9
|
-
"build": "npm run build:clean && npm run build:compile",
|
|
9
|
+
"build": "npm run build:clean && npm run build:compile && npm run build:artifact",
|
|
10
10
|
"test:types": "tsc -p ./tsconfig.build.json --noEmit"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"importsNotUsedAsValues": "remove",
|
|
5
5
|
"noPropertyAccessFromIndexSignature": false,
|
|
6
|
+
"noImplicitOverride": false,
|
|
6
7
|
"resolveJsonModule": true,
|
|
7
8
|
"sourceMap": true,
|
|
8
9
|
"outDir": "dist",
|
|
10
|
+
"target": "es6",
|
|
9
11
|
},
|
|
10
12
|
"include": [
|
|
11
|
-
"
|
|
13
|
+
"**/*.ts"
|
|
12
14
|
],
|
|
13
15
|
"exclude": [
|
|
14
16
|
"dist",
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
globals: {
|
|
5
|
-
'ts-jest': {
|
|
6
|
-
tsconfig: 'tsconfig.json',
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
verbose: true,
|
|
10
|
-
testEnvironment: 'node',
|
|
11
|
-
moduleFileExtensions: ['js', 'ts'],
|
|
12
|
-
testMatch: ['**/*.acceptance.test.ts'],
|
|
13
|
-
setupFiles: ['core-js'],
|
|
14
|
-
setupFilesAfterEnv: ['./jest.acceptance.env.js'],
|
|
15
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./jest.unit.config'); // default to unit tests
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
verbose: true,
|
|
5
|
-
testEnvironment: 'node',
|
|
6
|
-
moduleFileExtensions: ['js', 'ts'],
|
|
7
|
-
testMatch: ['**/*.integration.test.ts'],
|
|
8
|
-
setupFiles: ['core-js'],
|
|
9
|
-
setupFilesAfterEnv: ['./jest.integration.env.js'],
|
|
10
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
2
|
-
module.exports = {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
verbose: true,
|
|
5
|
-
testEnvironment: 'node',
|
|
6
|
-
moduleFileExtensions: ['js', 'ts'],
|
|
7
|
-
testMatch: [
|
|
8
|
-
// note: order matters
|
|
9
|
-
'**/*.test.ts',
|
|
10
|
-
'!**/*.acceptance.test.ts',
|
|
11
|
-
'!**/*.integration.test.ts',
|
|
12
|
-
],
|
|
13
|
-
setupFiles: ['core-js'],
|
|
14
|
-
setupFilesAfterEnv: ['./jest.unit.env.js'],
|
|
15
|
-
};
|