Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spaces are incorrectly parsed in the assertionOutput #160

@Jargonius

Description

@Jargonius

The problem is in template-utils.js

var pattern_regex = new RegExp(pattern.replace(special_chars_regex, '$&').replace(token_regex, '(.+)'));

var matches = str.match(pattern_regex);

The pattern_regex evaluates to /(.+) (.+) (.+) ((.+))/g which splits on spaces in the assertionOutput.

/*
test > Prints 'hello world'

hello('hello world') == 'hello world' (test)

*/
hello = function(str){
return 'hello world';
};

Hello world doesn't even work!

If pattern_regex was /(.+) (.+) (("|')(.+)("|')|(.+)) ((.+))/g it would fix the spaces inside strings but it doesn't account for spaces in json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions