Skip to content

Commit

Permalink
[Tests] no-extraneous-dependencies: Add some core-module tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarf authored and ljharb committed Oct 31, 2016
1 parent 6f5c52c commit fe51583
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/src/rules/no-extraneous-dependencies.js
Expand Up @@ -127,6 +127,21 @@ ruleTester.run('no-extraneous-dependencies', rule, {
test({ code: 'export class Component extends React.Component {}' }),
test({ code: 'export function Component() {}' }),
test({ code: 'export const Component = () => {}' }),

test({
code: 'import "not-a-dependency"',
filename: path.join(packageDirMonoRepoRoot, 'foo.js'),
options: [{ packageDir: packageDirMonoRepoRoot }],
settings: { 'import/core-modules': ['not-a-dependency'] },
}),
test({
code: 'import "@generated/bar/module"',
settings: { 'import/core-modules': ['@generated/bar'] },
}),
test({
code: 'import "@generated/bar/and/sub/path"',
settings: { 'import/core-modules': ['@generated/bar'] },
}),
],
invalid: [
test({
Expand Down Expand Up @@ -322,6 +337,15 @@ ruleTester.run('no-extraneous-dependencies', rule, {
message: "'chai' should be listed in the project's dependencies. Run 'npm i -S chai' to add it",
}],
}),

test({
code: 'import "not-a-dependency"',
filename: path.join(packageDirMonoRepoRoot, 'foo.js'),
options: [{ packageDir: packageDirMonoRepoRoot }],
errors: [{
message: `'not-a-dependency' should be listed in the project's dependencies. Run 'npm i -S not-a-dependency' to add it`,
}],
}),
],
});

Expand Down

0 comments on commit fe51583

Please sign in to comment.