Skip to content
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

fix a bunch of tests that were failing #1295

Merged
merged 2 commits into from
Mar 3, 2019
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
6 changes: 3 additions & 3 deletions tests/src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ describe('importType(name)', function () {
})

it("should return 'external' for module from 'node_modules' with default config", function() {
expect(importType('builtin-modules', context)).to.equal('external')
expect(importType('resolve', context)).to.equal('external')
})

it("should return 'internal' for module from 'node_modules' if 'node_modules' missed in 'external-module-folders'", function() {
const foldersContext = testContext({ 'import/external-module-folders': [] })
expect(importType('builtin-modules', foldersContext)).to.equal('internal')
expect(importType('resolve', foldersContext)).to.equal('internal')
})

it("should return 'external' for module from 'node_modules' if 'node_modules' contained in 'external-module-folders'", function() {
const foldersContext = testContext({ 'import/external-module-folders': ['node_modules'] })
expect(importType('builtin-modules', foldersContext)).to.equal('external')
expect(importType('resolve', foldersContext)).to.equal('external')
})
})
6 changes: 3 additions & 3 deletions tests/src/rules/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ ruleTester.run('export', rule, {
test({ code: 'export var [ foo, bar ] = array;' }),
test({ code: 'export var { foo, bar } = object;' }),
test({ code: 'export var [ foo, bar ] = array;' }),
test({ code: 'export { foo, foo as bar }' }),
test({ code: 'export { bar }; export * from "./export-all"' }),
test({ code: 'let foo; export { foo, foo as bar }' }),
test({ code: 'let bar; export { bar }; export * from "./export-all"' }),
test({ code: 'export * from "./export-all"' }),
test({ code: 'export * from "./does-not-exist"' }),

Expand Down Expand Up @@ -62,7 +62,7 @@ ruleTester.run('export', rule, {
// errors: ['Parsing error: Duplicate export \'foo\''],
// }),
test({
code: 'export { foo }; export * from "./export-all"',
code: 'let foo; export { foo }; export * from "./export-all"',
errors: ['Multiple exports of name \'foo\'.',
'Multiple exports of name \'foo\'.'],
}),
Expand Down
8 changes: 4 additions & 4 deletions tests/src/rules/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ ruleTester.run('extensions', rule, {
test({
code: [
'export { foo } from "./foo.js"',
'export { bar }',
'let bar; export { bar }',
].join('\n'),
options: [ 'always' ],
}),
test({
code: [
'export { foo } from "./foo"',
'export { bar }',
'let bar; export { bar }',
].join('\n'),
options: [ 'never' ],
}),
Expand Down Expand Up @@ -334,7 +334,7 @@ ruleTester.run('extensions', rule, {
test({
code: [
'export { foo } from "./foo"',
'export { bar }',
'let bar; export { bar }',
].join('\n'),
options: [ 'always' ],
errors: [
Expand All @@ -348,7 +348,7 @@ ruleTester.run('extensions', rule, {
test({
code: [
'export { foo } from "./foo.js"',
'export { bar }',
'let bar; export { bar }',
].join('\n'),
options: [ 'never' ],
errors: [
Expand Down
2 changes: 1 addition & 1 deletion tests/src/rules/named.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ruleTester.run('named', rule, {
}),

// regression tests
test({ code: 'export { foo as bar }'}),
test({ code: 'let foo; export { foo as bar }'}),

// destructured exports
test({ code: 'import { destructuredProp } from "./named-exports"' }),
Expand Down
5 changes: 3 additions & 2 deletions tests/src/rules/no-default-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ruleTester.run('no-default-export', rule, {
`,
}),
test({
code: `export { foo, bar }`,
code: `let foo, bar; export { foo, bar }`,
}),
test({
code: `export const { foo, bar } = item;`,
Expand All @@ -42,6 +42,7 @@ ruleTester.run('no-default-export', rule, {
}),
test({
code: `
let item;
export const foo = item;
export { item };
`,
Expand Down Expand Up @@ -102,7 +103,7 @@ ruleTester.run('no-default-export', rule, {
}],
}),
test({
code: 'export { foo as default }',
code: 'let foo; export { foo as default }',
errors: [{
ruleId: 'ExportNamedDeclaration',
message: 'Do not alias `foo` as `default`. Just export `foo` itself ' +
Expand Down
5 changes: 3 additions & 2 deletions tests/src/rules/no-named-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ruleTester.run('no-named-export', rule, {
code: 'export default function bar() {};',
}),
test({
code: 'export { foo as default }',
code: 'let foo; export { foo as default }',
}),
test({
code: 'export default from "foo.js"',
Expand Down Expand Up @@ -82,7 +82,7 @@ ruleTester.run('no-named-export', rule, {
}],
}),
test({
code: `export { foo, bar }`,
code: `let foo, bar; export { foo, bar }`,
errors: [{
ruleId: 'ExportNamedDeclaration',
message: 'Named exports are not allowed.',
Expand Down Expand Up @@ -111,6 +111,7 @@ ruleTester.run('no-named-export', rule, {
}),
test({
code: `
let item;
export const foo = item;
export { item };
`,
Expand Down
2 changes: 1 addition & 1 deletion tests/src/rules/no-unresolved.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function runResolverTests(resolver) {

rest({ code: 'export { foo } from "./bar"' }),
rest({ code: 'export * from "./bar"' }),
rest({ code: 'export { foo }' }),
rest({ code: 'let foo; export { foo }' }),

// stage 1 proposal for export symmetry,
rest({ code: 'export * as bar from "./bar"'
Expand Down
3 changes: 3 additions & 0 deletions tests/src/rules/prefer-default-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ruleTester.run('prefer-default-export', rule, {
}),
test({
code: `
let foo, bar;
export { foo, bar }`,
}),
test({
Expand All @@ -44,11 +45,13 @@ ruleTester.run('prefer-default-export', rule, {
}),
test({
code: `
let item;
export const foo = item;
export { item };`,
}),
test({
code: `
let foo;
export { foo as default }`,
}),
test({
Expand Down
4 changes: 2 additions & 2 deletions tests/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const SYNTAX_CASES = [
test({ code: 'const { x, y, ...z } = bar', parser: 'babel-eslint' }),

// all the exports
test({ code: 'export { x }' }),
test({ code: 'export { x as y }' }),
test({ code: 'let x; export { x }' }),
test({ code: 'let x; export { x as y }' }),

// not sure about these since they reference a file
// test({ code: 'export { x } from "./y.js"'}),
Expand Down