Skip to content

Commit

Permalink
[ExportMap] fix condition for checking if block comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ljqx authored and ljharb committed Nov 16, 2018
1 parent 918567d commit e4850df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ExportMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function captureJsDoc(comments) {
// capture XSDoc
comments.forEach(comment => {
// skip non-block comments
if (comment.value.slice(0, 4) !== '*\n *') return
if (comment.type !== 'Block') return
try {
doc = doctrine.parse(comment.value, { unwrap: true })
} catch (err) {
Expand Down
24 changes: 20 additions & 4 deletions tests/src/core/getExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ describe('ExportMap', function () {

context('deprecation metadata', function () {

function jsdocTests(parseContext) {
function jsdocTests(parseContext, lineEnding) {
context('deprecated imports', function () {
let imports
before('parse file', function () {
const path = getFilename('deprecated.js')
, contents = fs.readFileSync(path, { encoding: 'utf8' })
, contents = fs.readFileSync(path, { encoding: 'utf8' }).replace(/[\r]\n/g, lineEnding)
imports = ExportMap.parse(path, contents, parseContext)

// sanity checks
Expand Down Expand Up @@ -191,7 +191,15 @@ describe('ExportMap', function () {
attachComment: true,
},
settings: {},
})
}, '\n')
jsdocTests({
parserPath: 'espree',
parserOptions: {
sourceType: 'module',
attachComment: true,
},
settings: {},
}, '\r\n')
})

context('babel-eslint', function () {
Expand All @@ -202,7 +210,15 @@ describe('ExportMap', function () {
attachComment: true,
},
settings: {},
})
}, '\n')
jsdocTests({
parserPath: 'babel-eslint',
parserOptions: {
sourceType: 'module',
attachComment: true,
},
settings: {},
}, '\r\n')
})
})

Expand Down

0 comments on commit e4850df

Please sign in to comment.