Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Create custom jest error messages using jest-expect-message (no-changelog) #5666

Merged
merged 5 commits into from
May 5, 2023
Merged
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
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const config = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
setupFilesAfterEnv: ['jest-expect-message'],
collectCoverage: true,
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
collectCoverageFrom: ['src/**/*.ts'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"cypress-real-events": "^1.7.6",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-expect-message": "^1.1.3",
"jest-mock": "^29.5.0",
"jest-mock-extended": "^3.0.4",
"nock": "^13.2.9",
Expand Down
4 changes: 2 additions & 2 deletions packages/nodes-base/test/nodes/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ export const equalityTest = async (testData: WorkflowTestData, types: INodeTypes

// check if result node data matches expected test data
const resultNodeData = getResultNodeData(result, testData);

resultNodeData.forEach(({ nodeName, resultData }) => {
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
const msg = `Equality failed for "${testData.description}" at node "${nodeName}"`;
return expect(resultData, msg).toEqual(testData.output.nodeData[nodeName]);
});

expect(result.finished).toEqual(true);
Expand Down
27 changes: 16 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"sourceMap": true,
"skipLibCheck": true
},
"exclude": ["**/dist/**/*", "**/node_modules/**/*"]
"exclude": ["**/dist/**/*", "**/node_modules/**/*"],
"files": ["node_modules/jest-expect-message/types/index.d.ts"]
}