Skip to content

Commit

Permalink
WIP: Add failing named import/export tests
Browse files Browse the repository at this point in the history
  • Loading branch information
futpib committed Feb 15, 2019
1 parent b7a9c0b commit 5cc58e0
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion test/prevent-abbreviations.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import rule from '../rules/prevent-abbreviations';
const ruleTester = avaRuleTester(test, {
env: {
es6: true
},
parserOptions: {
sourceType: 'module'
}
});

Expand Down Expand Up @@ -117,7 +120,10 @@ ruleTester.run('prevent-abbreviations', rule, {
function f() {
return g.apply(this, arguments) + args;
}
`
`,

// Renaming would change the API of the module
'export const err = {};'
],

invalid: [
Expand Down Expand Up @@ -355,6 +361,36 @@ ruleTester.run('prevent-abbreviations', rule, {
};
`,
errors: createErrors()
},

{
code: `
import err from 'err';
`,
output: `
import error from 'err';
`,
errors: createErrors()
},
{
code: `
import {err} from 'err';
`,
output: `
import {err as error} from 'err';
`,
errors: createErrors()
},
{
code: `
let err;
export {err};
`,
output: `
let error;
export {error as err};
`,
errors: createErrors()
}
]
});

0 comments on commit 5cc58e0

Please sign in to comment.