خرید بک لینک

Vote count: 0

I'm using mocha-phantomjs.

This is the first time trying to set this up. I'm not bundling anything do I need to?? I don't think unless it's assumed people are using something like browserify most examples out there don't talk about using that and they show their code working.

Ultimately I am going to be ruing this mainly via console but figured why not get this test ruer working too.

Here are my files:

/test/features/specs

test-ruer.html

<html>
    <head>
        <meta charset="utf-8">
        <title>Mocha Tests</title>
    </head>
    <body>
    <!--<script type="text/javascript" src="../../../node_modules/requirejs" data-main="test-config.js"></script>-->
    <div id="mocha"></div>
    <!-- mocha dependencies -->
    <script type="text/javascript" src="../../../node_modules/mocha/mocha.js"></script>
    <script type="text/javascript" src="../../../node_modules/chai/chai.js"></script>
    <script>
        mocha.setup('bdd')
        expect = chai.expect
    </script>
    <!-- test files -->
    <script type="text/javascript" src='companies-list-spec.js'></script>
    </body>
</html>

companies-list-spec.js

'use strict';

var  mocha = require('mocha'),
    expect = require('chai').expect,
    phantom = require(''),
    page,
    pageStatus;

before(function() {
    phantom.create().then(function (error, ph) {
        ph.createPage().then(function () {
            console.log("got here!!!!")
            ph.open('../index.html', function (status) {
                page = ph;
                ph.exit();
                pageStatus = status
            })
        })
    })
})

describe('test setup', function() {
    it('should work', function() {
        expect(true).to.be.true;
    })
})

I'm getting this common error in the terminal:

ReferenceError: Can't find variable: require

the command I run at bash when I get the error is:

mocha-phantomjs test/features/specs/test-ruer.html

I've looked up pretty much ever result on a google search on this and it looks like it's a common problem but I'm not sure how to resolve it.

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 27 بهمن 1394 ساعت: 9:56

صفحه بندی