@cucumber/tag-expressions
Advanced tools
Comparing version 2.0.4 to 3.0.1
export {}; | ||
//# sourceMappingURL=tag_expression_parser_test.d.ts.map |
@@ -6,8 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var assert_1 = __importDefault(require("assert")); | ||
var tag_expression_parser_1 = __importDefault(require("../src/tag_expression_parser")); | ||
describe('TagExpressionParser', function () { | ||
describe('#parse', function () { | ||
; | ||
[ | ||
const assert_1 = __importDefault(require("assert")); | ||
const src_1 = __importDefault(require("../src")); | ||
describe('TagExpressionParser', () => { | ||
describe('#parse', () => { | ||
const tests = [ | ||
['', 'true'], | ||
@@ -26,9 +25,11 @@ ['a and b', '( a and b )'], | ||
], | ||
].forEach(function (inOut) { | ||
// a or not b | ||
]; | ||
tests.forEach(function (inOut) { | ||
it(inOut[0], function () { | ||
var infix = inOut[0]; | ||
var expr = tag_expression_parser_1.default(infix); | ||
const infix = inOut[0]; | ||
const expr = src_1.default(infix); | ||
assert_1.default.strictEqual(expr.toString(), inOut[1]); | ||
var roundtripTokens = expr.toString(); | ||
var roundtripExpr = tag_expression_parser_1.default(roundtripTokens); | ||
const roundtripTokens = expr.toString(); | ||
const roundtripExpr = src_1.default(roundtripTokens); | ||
assert_1.default.strictEqual(roundtripExpr.toString(), inOut[1]); | ||
@@ -46,7 +47,8 @@ }); | ||
['( ( a and b )', 'Syntax error. Unmatched ('], | ||
// a or not b | ||
].forEach(function (inOut) { | ||
it(inOut[0] + ' fails', function () { | ||
var infix = inOut[0]; | ||
const infix = inOut[0]; | ||
try { | ||
tag_expression_parser_1.default(infix); | ||
src_1.default(infix); | ||
throw new Error('Expected syntax error'); | ||
@@ -61,3 +63,3 @@ } | ||
it('evaluates not', function () { | ||
var expr = tag_expression_parser_1.default('not x'); | ||
const expr = src_1.default('not x'); | ||
assert_1.default.strictEqual(expr.evaluate(['x']), false); | ||
@@ -67,3 +69,3 @@ assert_1.default.strictEqual(expr.evaluate(['y']), true); | ||
it('evaluates and', function () { | ||
var expr = tag_expression_parser_1.default('x and y'); | ||
const expr = src_1.default('x and y'); | ||
assert_1.default.strictEqual(expr.evaluate(['x', 'y']), true); | ||
@@ -74,3 +76,3 @@ assert_1.default.strictEqual(expr.evaluate(['y']), false); | ||
it('evaluates or', function () { | ||
var expr = tag_expression_parser_1.default(' x or(y) '); | ||
const expr = src_1.default(' x or(y) '); | ||
assert_1.default.strictEqual(expr.evaluate([]), false); | ||
@@ -81,3 +83,3 @@ assert_1.default.strictEqual(expr.evaluate(['y']), true); | ||
it('evaluates expressions with escaped chars', function () { | ||
var expr = tag_expression_parser_1.default(' x\\(1\\) or(y\\(2\\)) '); | ||
const expr = src_1.default(' x\\(1\\) or(y\\(2\\)) '); | ||
assert_1.default.strictEqual(expr.evaluate([]), false); | ||
@@ -90,3 +92,3 @@ assert_1.default.strictEqual(expr.evaluate(['y(2)']), true); | ||
it('evaluates empty expressions to true', function () { | ||
var expr = tag_expression_parser_1.default(''); | ||
const expr = src_1.default(''); | ||
assert_1.default.strictEqual(expr.evaluate([]), true); | ||
@@ -93,0 +95,0 @@ assert_1.default.strictEqual(expr.evaluate(['y']), true); |
{ | ||
"name": "@cucumber/tag-expressions", | ||
"version": "2.0.4", | ||
"version": "3.0.1", | ||
"description": "Cucumber Tag Expression parser", | ||
"main": "dist/src/tag_expression_parser.js", | ||
"types": "dist/src/tag_expression_parser.d.ts", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"scripts": { | ||
"test": "mocha", | ||
"lint": "tslint src/**/*.ts test/**/*.ts", | ||
"lint-fix": "tslint --fix src/**/*.ts test/**/*.ts", | ||
"coverage": "nyc --reporter=html --reporter=text mocha", | ||
"build": "tsc", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "tsc --build tsconfig.build.json" | ||
}, | ||
@@ -29,17 +25,11 @@ "repository": { | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^13.1.6", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0", | ||
"prettier": "^1.19.1", | ||
"ts-node": "^8.6.0", | ||
"tslint": "^5.20.1", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-plugin-prettier": "^2.1.0", | ||
"typescript": "^3.7.4" | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^14.14.37", | ||
"mocha": "^8.3.2", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.3" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
@@ -5,3 +5,2 @@ # Cucumber Tag Expressions for JavaScript | ||
[![Build Status](https://travis-ci.org/cucumber/tag-expressions-javascript.svg?branch=master)](https://travis-ci.org/cucumber/tag-expressions-javascript) | ||
@@ -8,0 +7,0 @@ [The docs are here](https://cucumber.io/docs/cucumber/api/#tag-expressions). |
import assert from 'assert' | ||
import parse from '../src/tag_expression_parser' | ||
import parse from '../src' | ||
describe('TagExpressionParser', () => { | ||
describe('#parse', () => { | ||
;[ | ||
const tests = [ | ||
['', 'true'], | ||
@@ -21,4 +21,5 @@ ['a and b', '( a and b )'], | ||
// a or not b | ||
].forEach(function(inOut) { | ||
it(inOut[0], function() { | ||
] | ||
tests.forEach(function (inOut) { | ||
it(inOut[0], function () { | ||
const infix = inOut[0] | ||
@@ -43,4 +44,4 @@ const expr = parse(infix) | ||
// a or not b | ||
].forEach(function(inOut) { | ||
it(inOut[0] + ' fails', function() { | ||
].forEach(function (inOut) { | ||
it(inOut[0] + ' fails', function () { | ||
const infix = inOut[0] | ||
@@ -58,3 +59,3 @@ try { | ||
it('evaluates not', function() { | ||
it('evaluates not', function () { | ||
const expr = parse('not x') | ||
@@ -65,3 +66,3 @@ assert.strictEqual(expr.evaluate(['x']), false) | ||
it('evaluates and', function() { | ||
it('evaluates and', function () { | ||
const expr = parse('x and y') | ||
@@ -73,3 +74,3 @@ assert.strictEqual(expr.evaluate(['x', 'y']), true) | ||
it('evaluates or', function() { | ||
it('evaluates or', function () { | ||
const expr = parse(' x or(y) ') | ||
@@ -81,3 +82,3 @@ assert.strictEqual(expr.evaluate([]), false) | ||
it('evaluates expressions with escaped chars', function() { | ||
it('evaluates expressions with escaped chars', function () { | ||
const expr = parse(' x\\(1\\) or(y\\(2\\)) ') | ||
@@ -91,3 +92,3 @@ assert.strictEqual(expr.evaluate([]), false) | ||
it('evaluates empty expressions to true', function() { | ||
it('evaluates empty expressions to true', function () { | ||
const expr = parse('') | ||
@@ -94,0 +95,0 @@ assert.strictEqual(expr.evaluate([]), true) |
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"target": "es5", | ||
"lib": [ | ||
"es5", | ||
"es6", | ||
"es7", | ||
"es2015", | ||
"es2017", | ||
"dom" | ||
], | ||
"sourceMap": true, | ||
"allowJs": false, | ||
"jsx": "react", | ||
"resolveJsonModule": true, | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"noImplicitAny": true, | ||
"moduleResolution": "node", | ||
"outDir": "dist", | ||
"downlevelIteration": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": [ | ||
"src/**/*", | ||
"test/**/*" | ||
] | ||
"extends": "../../tsconfig.json" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
137033
5
617
19
1