mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
ci: Forbid skipping tests (no-changelog) (#6199)
This commit is contained in:
parent
e046f656fe
commit
fe937a0ee3
|
@ -452,8 +452,11 @@ const config = (module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['test/**/*.ts'],
|
files: ['test/**/*.ts'],
|
||||||
// TODO: Remove these
|
|
||||||
rules: {
|
rules: {
|
||||||
|
'n8n-local-rules/no-skipped-tests':
|
||||||
|
process.env.NODE_ENV === 'development' ? 'warn' : 'error',
|
||||||
|
|
||||||
|
// TODO: Remove these
|
||||||
'@typescript-eslint/await-thenable': 'off',
|
'@typescript-eslint/await-thenable': 'off',
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
'@typescript-eslint/naming-convention': 'off',
|
'@typescript-eslint/naming-convention': 'off',
|
||||||
|
|
|
@ -170,6 +170,46 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'no-skipped-tests': {
|
||||||
|
meta: {
|
||||||
|
type: 'problem',
|
||||||
|
docs: {
|
||||||
|
description: 'Tests must not be skipped.',
|
||||||
|
recommended: 'error',
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
removeSkip: 'Remove `.skip()` call',
|
||||||
|
removeOnly: 'Remove `.only()` call',
|
||||||
|
},
|
||||||
|
fixable: 'code',
|
||||||
|
},
|
||||||
|
create(context) {
|
||||||
|
const TESTING_FUNCTIONS = new Set(['test', 'it', 'describe']);
|
||||||
|
const SKIPPING_METHODS = new Set(['skip', 'only']);
|
||||||
|
const toMessageId = (s) => 'remove' + s.charAt(0).toUpperCase() + s.slice(1);
|
||||||
|
|
||||||
|
return {
|
||||||
|
MemberExpression(node) {
|
||||||
|
if (
|
||||||
|
node.object.type === 'Identifier' &&
|
||||||
|
TESTING_FUNCTIONS.has(node.object.name) &&
|
||||||
|
node.property.type === 'Identifier' &&
|
||||||
|
SKIPPING_METHODS.has(node.property.name)
|
||||||
|
) {
|
||||||
|
context.report({
|
||||||
|
messageId: toMessageId(node.property.name),
|
||||||
|
node,
|
||||||
|
fix: (fixer) => {
|
||||||
|
const [start, end] = node.property.range;
|
||||||
|
return fixer.removeRange([start - '.'.length, end]);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
'no-interpolation-in-regular-string': {
|
'no-interpolation-in-regular-string': {
|
||||||
meta: {
|
meta: {
|
||||||
type: 'problem',
|
type: 'problem',
|
||||||
|
|
|
@ -26,6 +26,7 @@ afterAll(async () => {
|
||||||
await testDb.terminate();
|
await testDb.terminate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||||
test.skip('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 testDb.createUser({ globalRole: globalOwnerRole });
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ test('GET /eventbus/destination all returned destinations should exist in eventb
|
||||||
});
|
});
|
||||||
|
|
||||||
// this test (presumably the mocking) is causing the test suite to randomly fail
|
// this test (presumably the mocking) is causing the test suite to randomly fail
|
||||||
|
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||||
test.skip('should send message to syslog', async () => {
|
test.skip('should send message to syslog', async () => {
|
||||||
const testMessage = new EventMessageGeneric({
|
const testMessage = new EventMessageGeneric({
|
||||||
eventName: 'n8n.test.message' as EventNamesTypes,
|
eventName: 'n8n.test.message' as EventNamesTypes,
|
||||||
|
@ -217,6 +218,7 @@ test.skip('should send message to syslog', async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||||
test.skip('should confirm send message if there are no subscribers', async () => {
|
test.skip('should confirm send message if there are no subscribers', async () => {
|
||||||
const testMessageUnsubscribed = new EventMessageGeneric({
|
const testMessageUnsubscribed = new EventMessageGeneric({
|
||||||
eventName: 'n8n.test.unsub' as EventNamesTypes,
|
eventName: 'n8n.test.unsub' as EventNamesTypes,
|
||||||
|
|
|
@ -245,6 +245,7 @@ describe('GET /executions', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// failing on Postgres and MySQL - ref: https://github.com/n8n-io/n8n/pull/3834
|
// failing on Postgres and MySQL - ref: https://github.com/n8n-io/n8n/pull/3834
|
||||||
|
// eslint-disable-next-line n8n-local-rules/no-skipped-tests
|
||||||
test.skip('should paginate two executions', async () => {
|
test.skip('should paginate two executions', async () => {
|
||||||
const workflow = await testDb.createWorkflow({}, owner);
|
const workflow = await testDb.createWorkflow({}, owner);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue