qualityfaster
qualityfaster copied to clipboard
Can't import { Meteor } from 'meteor/meteor'.
It doesn't seem like you can explicitly import package dependencies at the moment. Trying to do import { Meteor } from 'meteor/meteor'
results in 'Module not found: Error: Cannot resolve module 'meteor/meteor' in ...`.
I'm trying to devise a way to make this work and could use some feedback. I'm very new to wallaby but it seems like there would be two steps to this.
One, we would need to preprocess the source files, look for any import statements that begin with "meteor/", and transform them from import { Meteor} from "meteor/meteor"
into something like import { Meteor } from ".meteor/local/build/programs/web.browser/packages/meteor"
.
Two, we would add some sort of compiler to meteor packages to transform them from exporting to the global Package object to a babel compatible format (What would do achieve this?).
Any thoughts? Thanks!
I think there should be a warning in the README that this does not work at the moment, before promoting wallaby.js as a good option to run tests, it is a paid software after all.
btw this issue is related/duplicate to https://github.com/xolvio/automated-testing-best-practices/issues/59
@danimbrogno You need to run inside server.excute
function to access your project scope and meteor variables.
Example fetching users:
const users = server.execute(() => {
return Meteor.users.find().fetch()
})
More about this approach on the docs. I am also writing some demos at this repository are interested.