Monday 10 April 2017

run-headless-chromium test file not working

I am trying to get the node module 'run-headless-chromium' to run a spec file but keep getting the error E/configParser - ReferenceError: jasmine is not defined. Here is my file (testfile.js):

var jasmineEnv = jasmine.getEnv();

var consoleReporter = new jasmine.ConsoleReporter({
    print: function print(message) {
        console.log(message + '\x03\b');
    },
    onComplete: function onComplete(isSuccess) {
        var exitCode = isSuccess ? 0 : 1;
        console.info('All tests completed!' + exitCode);
    },
    showColors: true
});

jasmineEnv.addReporter(consoleReporter);
jasmineEnv.execute();

For reference, here is the original example file from the run-headless-chromium page. It's exactly the same except for the script tags that reference jasmine:

<script src="jasmine/lib/jasmine-core/jasmine.js"></script>
<script src="jasmine/lib/console/console.js"></script>
<script>
var jasmineEnv = jasmine.getEnv();

var consoleReporter = new jasmine.ConsoleReporter({
    print: function print(message) {
        console.log(message + '\x03\b');
    },
    onComplete: function onComplete(isSuccess) {
        var exitCode = isSuccess ? 0 : 1;
        console.info('All tests completed!' + exitCode);
    },
    showColors: true
});

jasmineEnv.addReporter(consoleReporter);
jasmineEnv.execute();



via John123

No comments:

Post a Comment