Skip to content

Commit

Permalink
add tests for import/external-module-folders
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 20, 2016
1 parent 36b9ccb commit 38c28f1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/src/core/importType.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,18 @@ describe('importType(name)', function () {
const electronContext = testContext({ 'import/core-modules': ['electron'] })
expect(importType('electron', electronContext)).to.equal('builtin')
})

it("should return 'external' for module from 'node_modules' with default config", function() {
expect(importType('builtin-modules', 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')
})

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')
})
})

0 comments on commit 38c28f1

Please sign in to comment.