ci: Setup code-coverage reporting (no-changelog) (#5669)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-03-10 16:53:05 +01:00 committed by GitHub
parent 5f238ea641
commit 3831201aaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 8 deletions

View file

@ -35,6 +35,11 @@ jobs:
- name: Test
run: pnpm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: packages/cli/coverage/cobertura-coverage.xml,packages/nodes-base/coverage/cobertura-coverage.xml,packages/core/coverage/cobertura-coverage.xml,packages/workflow/coverage/cobertura-coverage.xml
- name: Lint
env:
CI_LINT_MASTER: true

View file

@ -67,6 +67,11 @@ jobs:
- name: Test
run: pnpm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: packages/cli/coverage/cobertura-coverage.xml,packages/nodes-base/coverage/cobertura-coverage.xml,packages/core/coverage/cobertura-coverage.xml,packages/workflow/coverage/cobertura-coverage.xml
lint:
name: Lint changes
runs-on: ubuntu-latest

1
.gitignore vendored
View file

@ -3,6 +3,7 @@ node_modules
.tmp
tmp
dist
coverage
npm-debug.log*
yarn.lock
google-generated-credentials.json

View file

@ -22,11 +22,15 @@ const config = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
collectCoverage: true,
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
collectCoverageFrom: ['src/**/*.ts'],
};
if (process.env.CI === 'true') {
config.maxWorkers = 2;
config.workerIdleMemoryLimit = 2048;
config.coverageReporters = ['cobertura'];
}
module.exports = config;

View file

@ -11,4 +11,5 @@ module.exports = {
'^@/(.*)$': '<rootDir>/src/$1',
'^@db/(.*)$': '<rootDir>/src/databases/$1',
},
coveragePathIgnorePatterns: ['/src/databases/migrations/'],
};

View file

@ -26,7 +26,7 @@ afterAll(async () => {
await testDb.terminate();
});
test('user-management:reset should reset DB to default user state', async () => {
test.skip('user-management:reset should reset DB to default user state', async () => {
await testDb.createUser({ globalRole: globalOwnerRole });
await Reset.run();

View file

@ -1,3 +1,2 @@
coverage
storybook-static
**/*.stories.js

View file

@ -1,2 +1,5 @@
/** @type {import('jest').Config} */
module.exports = require('../../jest.config');
module.exports = {
...require('../../jest.config'),
collectCoverageFrom: ['credentials/**/*.ts', 'nodes/**/*.ts', 'utils/**/*.ts'],
};

View file

@ -1,5 +1,5 @@
import { readFileSync, readdirSync, mkdtempSync } from 'fs';
import { BinaryDataManager, Credentials, loadClassInIsolation } from 'n8n-core';
import { BinaryDataManager, Credentials } from 'n8n-core';
import {
ICredentialDataDecryptedObject,
ICredentialsHelper,
@ -194,10 +194,9 @@ export function setup(testData: Array<WorkflowTestData> | WorkflowTestData) {
if (!loadInfo) {
throw new Error(`Unknown node type: ${nodeName}`);
}
const node = loadClassInIsolation(
path.join(process.cwd(), loadInfo.sourcePath),
loadInfo.className,
) as INodeType;
const sourcePath = loadInfo.sourcePath.replace(/^dist\//, './').replace(/\.js$/, '.ts');
const nodeSourcePath = path.join(process.cwd(), sourcePath);
const node = new (require(nodeSourcePath)[loadInfo.className])() as INodeType;
nodeTypes.addNode(nodeName, node);
}