Reputation: 686
I am trying to figure out how to use Mocha Testing with Meteor. I found this tutorial: https://www.meteor.com/tutorials/react/testing and I am getting this error at step "11.3 Prepare the database for each test":
Error: Can't find npm module 'client/tasks.js'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
I tried to adjust import path for my task.js file:
import { Tasks } from '../../client/tasks.js';
My project directory structure:
imports/api/tasks.tests.js
client/tasks.js
client/tasks.html
server/methods.js
mycollection.js
I don't use react, just blaze. I have meteor.methods for database/collection manipulation like "rename task", "create task" etc.
My tasks.js and tasks.html are in the client folder. From the client/tasks.js I am calling with Meteor.call() my Meteor.methods, for example:
Template.myTemplate.events({
'change .field': function(e) {
var newName = e.target.value;
Meteor.call('renameTask', this._id, newName);
},
How can I transfer this tutorial to my example with Meteor.call? A small working example with Meteor.call() would help me a lot.
If it is relevant: Meteor is installed on Windows 10 System.
Upvotes: 2
Views: 901
Reputation: 9086
You can give relative path for you file like:
import { Tasks } from '../client/tasks.js';
Or an absolute path like:
import { Tasks } from '/client/tasks.js';
Please refer your directory structure and give a path accordingly.
Upvotes: 0