@magento/directive-parser
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Parses Magento PWA Studio directives", | ||
@@ -9,0 +9,0 @@ "main": "src/index.js", |
@@ -10,6 +10,32 @@ const parseDirective = require('..'); | ||
`); | ||
expect(errors.length).toBe(0); | ||
expect(errors[0]).toBeFalsy(); | ||
expect(directives.length).toBe(1); | ||
}); | ||
test('Can parse a single directive in a file with single-line comments', () => { | ||
const { errors, directives } = parseDirective(` | ||
/** | ||
* @RootComponent | ||
* pageTypes = foo, bizz | ||
*/ | ||
module.exports = () => {}; | ||
// a single line comment | ||
`); | ||
expect(errors[0]).toBeFalsy(); | ||
expect(directives.length).toBe(1); | ||
}); | ||
test('Can parse a single directive in a file with source map annotations', () => { | ||
const { errors, directives } = parseDirective(` | ||
/** | ||
* @RootComponent | ||
* pageTypes = foo, bizz | ||
*/ | ||
module.exports = () => {}; | ||
//# sourceMappingURL=index.js.map | ||
`); | ||
expect(errors[0]).toBeFalsy(); | ||
expect(directives.length).toBe(1); | ||
}); | ||
test('Can parse a single directive in a file, and report error below it', () => { | ||
@@ -16,0 +42,0 @@ const { errors, directives } = parseDirective(` |
const reWhitespace = /\s/; | ||
const reIdentifierChar = /[\w-]/; | ||
const reIdentifierChar = /[^'"@=,\*\/\s]/; | ||
const reNewLine = /\n/; | ||
@@ -4,0 +4,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26681
439