Skip to content

Breaking: change test-case-property-ordering default options (fixes #79) #93

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

Merged
merged 1 commit into from
Apr 8, 2021
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
12 changes: 11 additions & 1 deletion lib/rules/test-case-property-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ module.exports = {
// Public
// ----------------------------------------------------------------------
const message = 'The properties of a test case should be placed in a consistent order: [{{order}}].';
const order = context.options[0] || ['code', 'output', 'options', 'parserOptions', 'errors'];
const order = context.options[0] || [
'filename',
'code',
'output',
'options',
'parser',
'parserOptions',
'globals',
'env',
'errors',
];
const sourceCode = context.getSourceCode();

return {
Expand Down
26 changes: 13 additions & 13 deletions tests/lib/rules/require-meta-docs-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ tester.run('require-meta-docs-url', rule, {
}],
},
{
filename: 'test-rule',
code: `
module.exports = {
meta: {docs: {url: "path/to/test-rule.md"}},
Expand All @@ -64,7 +65,6 @@ tester.run('require-meta-docs-url', rule, {
options: [{
pattern: 'path/to/{{name}}.md',
}],
filename: 'test-rule',
},
],

Expand Down Expand Up @@ -396,6 +396,7 @@ tester.run('require-meta-docs-url', rule, {
// pattern option with filename
// -------------------------------------------------------------------------
{
filename: 'test.js',
code: `
module.exports = function() {}
`,
Expand All @@ -404,9 +405,9 @@ tester.run('require-meta-docs-url', rule, {
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta,
Expand All @@ -418,9 +419,9 @@ tester.run('require-meta-docs-url', rule, {
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: 100,
Expand All @@ -432,9 +433,9 @@ tester.run('require-meta-docs-url', rule, {
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {},
Expand All @@ -455,9 +456,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -481,9 +482,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -507,9 +508,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -523,9 +524,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -548,9 +549,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -576,9 +577,9 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -604,9 +605,9 @@ url: "plugin-name/test.md",
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -631,9 +632,9 @@ url: "plugin-name/test.md",
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['`meta.docs.url` property must be `plugin-name/test.md`.'],
filename: 'test.js',
},
{
filename: 'test.js',
code: `
module.exports = {
meta: {
Expand All @@ -659,7 +660,6 @@ url: "plugin-name/test.md"
pattern: 'plugin-name/{{ name }}.md',
}],
errors: ['Rules should export a `meta.docs.url` property.'],
filename: 'test.js',
},
],
});
7 changes: 7 additions & 0 deletions tests/lib/rules/test-case-property-ordering.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ ruleTester.run('test-case-property-ordering', rule, {
]
});
`,
`
new RuleTester().run('foo', bar, {
valid: [
{ filename: '', code: '', output: '', options: '', parser: '', parserOptions: '', globals: '', env: '', errors: '' },
]
});
`,
{
code: `
new RuleTester().run('foo', bar, {
Expand Down