<html>
<head>
<meta charset="utf-8">
<!-- encoding must be set for mocha's special characters to render properly -->
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
<link rel="stylesheet" href="../../bin/enyo.css"/>
</head>
<body>
<div id="mocha"></div>
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../bin/enyo.js"></script>
<script src="../../bin/layout.js"></script>
<script>
mocha.setup('bdd');
var assert = chai.assert;
var expect = chai.expect;
var should = chai.should();
//trying to define enyo here so that I can test my source files without packing.
var enyo = enyo || (enyo = {})
, manifest = enyo.__manifest__ || (defineProperty(enyo, '__manifest__', {value: {}}) && enyo.__manifest__)
, exported = enyo.__exported__ || (defineProperty(enyo, '__exported__', {value: {}}) && enyo.__exported__)
, require = enyo.require || (defineProperty(enyo, 'require', {value: enyoRequire}) && enyo.require);
var module = {};
</script>
<!-- These are my source code files for the application -->
<script src="../../src/HomePage.js"></script>
<script src="../../src/AppRouter.js"></script>
<script src="../../src/index.js"></script>
<script>
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
</script>
</body>
</html>
So when I run this test, I get the following output.
Error: Could not find module "./HomePage"
in enyoRequire at file:///home/chad/NetBeansProjects/PlayConnect360/bin/enyo.js:40
at file:///home/chad/NetBeansProjects/PlayConnect360/src/index.js:8
[email protected]:~/NetBeansProjects/PlayConnect360$ /home/chad/.nvm/versions/node/v7.5.0/bin/node /home/chad/.nvm/versions/node/v7.5.0/bin/mocha-phantomjs tests/unit/test.html
Error: Could not find module "./HomePage"
in enyoRequire at file:///home/chad/NetBeansProjects/PlayConnect360/bin/enyo.js:40
at file:///home/chad/NetBeansProjects/PlayConnect360/src/index.js:8
var ready = require('enyo/ready')
, kind = require('enyo/kind')
, dom = require('enyo/dom')
, Application = require('enyo/Application')
, HomePage = require('./HomePage')
Am I going at this the wrong way? I would prefer to not pack the application each time I want to run my tests, and even if i pack the application I'm still not sure how I would write my unit tests to access the packed code. Can I modify the way enyo looks for my modules? It looks like you're new here. If you want to get involved, click one of these buttons!
Comments