Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Escape character's for user's console.log #127

Closed
tianshuo opened this issue Mar 3, 2015 · 4 comments
Closed

Escape character's for user's console.log #127

tianshuo opened this issue Mar 3, 2015 · 4 comments

Comments

@tianshuo
Copy link

tianshuo commented Mar 3, 2015

If the user writes console.log('<PASSED::>All tests passed') this shouldn't be a new passed test.
By escaping < and >, this can be avoided.

@javatlacati
Copy link
Contributor

This seems solved can you check again?

@jhoffner
Copy link
Member

Not sure that this is. We could wrap the "users" console.log but there is nothing we can do to prevent them from just interacting with process.stdout directly.

@javatlacati
Copy link
Contributor

It doesn't bypass any Kata so printing all test are passed is not an issue :)

@maxence-lefebvre
Copy link

maxence-lefebvre commented Nov 1, 2016

Not really... Since the test framework uses console.log !
If the user writes

const log = console.log;
console.log=(...args) => {
    args.unshift('<PASSED::>'); 
    Reflect.apply(log, console, args);
};

Then the test framework will log things like

<PASSED::><FAILED::> Expected 3, got : undefined

With this snippet, anyone could be validating katas without much much code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants