Skip to content

Commit

Permalink
add jest-dynalite for DDB testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ebisbe committed Jul 7, 2024
1 parent b160b99 commit 5a548cb
Show file tree
Hide file tree
Showing 7 changed files with 644 additions and 67 deletions.
30 changes: 30 additions & 0 deletions jest-dynalite-config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { ddb_table } = process.env;

module.exports = {
tables: [
{
TableName: ddb_table,
AttributeDefinitions: [
{
AttributeName: "pk",
AttributeType: "S",
},
{
AttributeName: "sk",
AttributeType: "S",
},
],
KeySchema: [
{
AttributeName: "pk",
KeyType: "HASH",
},
{
AttributeName: "sk",
KeyType: "RANGE",
},
],
BillingMode: "PAY_PER_REQUEST",
},
],
};
8 changes: 4 additions & 4 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const config = {
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,
collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
Expand Down Expand Up @@ -103,7 +103,7 @@ const config = {
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
preset: "ts-jest",
preset: "jest-dynalite",

extensionsToTreatAsEsm: [".ts"],

Expand Down Expand Up @@ -140,7 +140,7 @@ const config = {
setupFiles: ["dotenv/config"],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
setupFilesAfterEnv: ["<rootDir>/setupFilesAfterEnv_dynalite.ts"],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand All @@ -149,7 +149,7 @@ const config = {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: "node",
//testEnvironment: "node",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.8.0",
"jest": "^29.7.0",
"jest-dynalite": "^3.6.1",
"prettier": "3.3.2",
"serverless": "^4.1.11",
"ts-jest": "^29.1.5",
Expand Down
Loading

0 comments on commit 5a548cb

Please sign in to comment.