How do I reliably execute Jasmine tests that utilize requirejs via phantomjs?

后端 未结 2 1807
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 04:55

I am using phantomjs to run jasmine test. My jasmine tests are using require around the describe blocks to ensure all the right modules are loaded.

My tests would no

2条回答
  •  Happy的楠姐
    2020-12-17 05:21

    I did something a little different -- my HTML page has a function, wrapped in a require() call:

    var run_tests = function (specfiles) {
        require(specfiles, function () {
            jasmine.getEnv().execute();
        });
    };
    

    Then I page.evaluate( function (test_specs) { run_tests(test_specs) }, ['test1.spec', 'test2.spec']);

提交回复
热议问题