Files
react-native-devtools-frontend/scripts/eslint_rules/lib/no_repeated_tests.js
T
Peter Marshall f8f4ea4e9f tests: Add a lint check for it.repeat()
We don't want these accidentally committed.

Bug: 1101782
Change-Id: I67a820bbaa6b8a8d1cb4a1a6afdb29bc8dacdc5e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2354107
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2020-08-17 08:04:25 +00:00

31 lines
804 B
JavaScript

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Rule to check that .repeat() is not used in mocha tests
* @author Peter Marshall
*/
'use strict';
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'usage of .repeat() in mocha tests',
category: 'Possible Errors',
},
fixable: 'code',
schema: [] // no options
},
create: function(context) {
return {
MemberExpression(node) {
if (node.object.name === 'it' && node.property.name === 'repeat' && node.parent.type === 'CallExpression') {
context.report({node, message: 'Unexpected repeated mocha test'});
}
}
};
}
};