Giter VIP home page Giter VIP logo

cleaner's People

Contributors

cwohlman avatar didericis avatar fkint avatar lgandecki avatar samhatoum avatar sanjo avatar sanjosolutions avatar simonsimcity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cleaner's Issues

Can't use on the client side?

I haven't tested this, but the code seems like it won't work on the client side because of this line. Meteor won't let an untrusted code use an arbitrary Mongo selector with collection.remove.

This might be a problem when doing client integration tests.

If that's the case, how about implementing something like this PR by @riebeekn?
sungwoncho/factory-boy#3

Method arguments are not checked

If the 'audit-argument-checks' package is installed, an invocation of 'resetDatabase' from the client will fail because the Meteor method definition is not checking the options argument.

Migrate to async (Meteor 2.8 and onwards)

This package will need to be updated for fibers-free meteor:

  • Handle that the defaultRemoteCollectionDriver() returns a Promise in 2.8 and later
  • Remove usages of Meteor.wrapAsync, make core method async instead

New release?

Any chance you could tag a new release on Atmosphere so we can take advantage of the excludedCollections functionality?

resetDatabase cause error on meteor 1.6.1

Just upgraded my meteor project to version 1.6.1 and my meteor server tests starts to fail.
They are work fine on version 1.6.0.1 and fail on 1.6.1 with error on calling beforeEach hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test
Tried to use this.timeout() function with no luck.
BTW, I'm using meteortesting:mocha package.

`resetDatabase` fails to run client-side for projects with `audit-argument-checks` package added

Since the resetDatabase method call doesn't check the options argument, it fails to run when audit-argument-checks is enabled, with the following error:

Exception while invoking method 'xolvio:cleaner/resetDatabase' Error: Did not check() all arguments during call to 'xolvio:cleaner/resetDatabase'

A simple fix to this would be to check the options argument with:
check(options, Match.Optional(Object)).

Change NODE_ENV check to be against 'production'

I'd trying to use a separate NODE_ENV for testing: NODE_ENV=test meteor ...

But xolvio:cleaner currently checks process.env.NODE_ENV !== 'development'and blows up.

I think it would be better and more flexible to change this check to: process.env.NODE_ENV === 'production', as this will allow other environments.

Does this sound like a good idea?

ReferenceError: MongoInternals is not defined

The following error occurs when package testing:

W20160524-15:04:50.610(-6)? (STDERR) ReferenceError: MongoInternals is not defined
W20160524-15:04:50.610(-6)? (STDERR)     at packages/xolvio:cleaner/cleaner.js:36:15

I have figured out the solution. Basically, in the case of package testing, explicitly add 'mongo' (and aswell as underscore) as dependencies. I'll make a pr.

Doesn't work with capped collections

Apparently you can't remove documents from a capped collection: https://docs.mongodb.org/manual/core/capped-collections/
I'm getting this error:

MongoError: cannot remove from a capped collection: meteor.useful:logs/logs
  @ Object.Future.wait (/Users/joshua/.meteor/packages/meteor-tool/.1.1.3.1rio88++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
  @ packages/meteor/helpers.js:119:1
  @ packages/xolvio_cleaner.js:41:5

The annoying thing is that this crashes my entire test, the only way to get my tests working is to temporarily convert my collection to an ordinary collection by commenting out the code that makes a capped collection.

If I get a chance I'll look into adding a pull request for this, it looks like it should be pretty simple to fix.

In the mean time fixing #6 would be a nice workaround.

Feature Request: Whitelist Collections

Example Use Case

I'm populating meteor_accounts_loginServiceConfiguration on Meteor.startup() only, would be nice to be able to keep that one collection's content accross scenarios.

MongoInternals is not defined

I am trying to use this package in a package test that uses practicalmeteor:mocha as the test runner. My test is server side only when I am getting the following error:

Error: MongoInternals is not defined
    at resetDatabase (packages/xolvio_cleaner/packages/xolvio_cleaner.js:22:1)
    at Hook.<anonymous> (packages/local-test:tdb:organizations/tests/methods.js:8:7)
    at run (packages/practicalmeteor:mocha-core/server.js:56:16)

This is my Package.onTest:

Package.onTest(function(api) {
  api.use([
    'ecmascript',
    'mongo',
    'practicalmeteor:mocha',
    'xolvio:cleaner',
    'practicalmeteor:chai',
    'tdb:organizations'
  ]);
  api.addFiles([
   'tests/index.js',
   'tests/methods.js'
  ]);
});

What could be wrong?

UPDATE - 5 minutes later
I could make my test work by not using this package with the following approach:

if (Meteor.isServer) {
  Meteor.methods({
    'test.cleanOrganizations': () => Organizations.remove({})
  });

  describe('tdb:organizations - methods', () => {
    beforeEach( done => {
      Meteor.call('test.cleanOrganizations', done);
    });
...

So I think the problem is not related with the mongo dependency because my collection is using it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.