Comments (16)
The database is reseted before each scenario. You need to insert the service configuration after this line.
from qualityfaster.
Do you have a hint how? @sanjo
from qualityfaster.
I have a regular service configuration file like this:
ServiceConfiguration.configurations.remove({
service: 'facebook',
});
ServiceConfiguration.configurations.insert({
service: 'facebook',
appId: '1x060107363xxxx2',
secret: '6x5c67c5xxxxxxxxxcf5e0ab',
});
from qualityfaster.
How would I rerun that file for the tests?
from qualityfaster.
Just expose this code as a function on the server side. The server.execute blocks runs on the server. With ES2015 modules it is:
export function configureServices() {
ServiceConfiguration.configurations.remove({
service: 'facebook',
});
ServiceConfiguration.configurations.insert({
service: 'facebook',
appId: '1x060107363xxxx2',
secret: '6x5c67c5xxxxxxxxxcf5e0ab',
});
}
Code that comes after https://github.com/xolvio/automated-testing-best-practices/blob/master/tests/step_definitions/critical/support/fixtures/common-fixtures.js#L6:
require('/imports/path/to/services_configurations.js').configureServices();
If you don't use ES2015 modules, you can expose the function on the global scope. global.configureServices = ...
.
from qualityfaster.
@sanjo I did try it that way, but now I get this error
Before
Error: Error in server.executeReferenceError: _serviceConfigurations is not defined
ReferenceError: _serviceConfigurations is not defined
@ evalmachine.<anonymous>:3:11
@ [object Object].xolvioBackdoor (packages/xolvio:backdoor/server.js:10:54)
@ maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
@ packages/ddp-server/livedata_server.js:711:19
@ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
@ packages/ddp-server/livedata_server.js:709:40
@ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
@ packages/ddp-server/livedata_server.js:707:46
@ tryCallTwo (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)
@ doResolve (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:200:13)
So I think there is something meteor serviceConfigurations related missing... :(
from qualityfaster.
@sanjo any ideas on how to solve this?
from qualityfaster.
Post the server.execute code block please.
from qualityfaster.
this is the server block:
server.execute(function () {
Package['xolvio:cleaner'].resetDatabase();
configureServices();
});
from qualityfaster.
Do you have any idea, in which code the _serviceConfigurations
reference is that is mentioned in the error?
from qualityfaster.
Oh that's interesting. The variable exists only in the generated source code:
var require = meteorInstall({"imports":{"infrastructure":{"server":{"serviceConfigurations.js":function(require,exports){
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// imports/infrastructure/server/serviceConfigurations.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
exports.__esModule = true; //
exports.configureServices = configureServices; //
function configureServices() { // 1
//
console.log("ServiceConfiguration loading"); // 3
//
ServiceConfiguration.configurations.remove({ // 5
service: 'facebook' // 6
}); //
//
ServiceConfiguration.configurations.insert({ // 9
service: 'facebook', // 10
appId: 'xxxx', // 11
secret: 'xxxx' // 12
}); //
} //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
}}}},"entry":{"server":{"module-loader.js":function(require){
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// entry/server/module-loader.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Force meteor to load modules at build time, so they can be required in Chimp's server.execute //
// if (false) { //
// require('./imports/validation'); //
// require('./imports/models/account-holder'); //
// require('./imports/domain/services/bank-service'); //
// require('./imports/domain/services/bank-service/server'); //
// require('./imports/application/services/account-service'); //
// require('./imports/application/services/account-service/server'); //
// require('./imports/application/services/bank-service/server'); //
// } //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
},"main.js":["../../imports/infrastructure/server/serviceConfigurations",function(require){
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// entry/server/main.js //
// //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
var _serviceConfigurations = require('../../imports/infrastructure/server/serviceConfigurations'); // 7
//
(0, _serviceConfigurations.configureServices)(); // import '../../imports/infrastructure/collections';
// import '../../imports/infrastructure/server/publications'; //
// import '../../imports/application/services/bank-service/server/bank-service-api'; //
//
//import '../../imports/infrastructure/server/serviceConfigurations'; //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
}]}}},{"extensions":[".js",".json",".jsx"]});
require("./entry/server/module-loader.js");
require("./entry/server/main.js");
//# sourceMappingURL=app.js.map
Here is how the original main.js looks like:
// import '../../imports/infrastructure/collections';
// import '../../imports/infrastructure/server/publications';
// import '../../imports/application/services/bank-service/server/bank-service-api';
//import '../../imports/infrastructure/server/serviceConfigurations';
import { configureServices } from '../../imports/infrastructure/server/serviceConfigurations';
configureServices();
from qualityfaster.
Try this:
server.execute(function () {
Package['xolvio:cleaner'].resetDatabase();
const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
configureServices();
});
In server.execute you always need to use require instead of import. And you need to specify an absolute path. The root of the path is your app root. Like in the code above.
from qualityfaster.
hmmm... did it. Now I get this error:
Error: Error in server.executeReferenceError: require is not defined
ReferenceError: require is not defined
@ evalmachine.<anonymous>:5:22
@ [object Object].xolvioBackdoor (packages/xolvio:backdoor/server.js:10:54)
@ maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
@ packages/ddp-server/livedata_server.js:711:19
@ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
@ packages/ddp-server/livedata_server.js:709:40
@ [object Object]._.extend.withValue (packages/meteor.js:1100:17)
@ packages/ddp-server/livedata_server.js:707:46
@ tryCallTwo (/Users/ap/.meteor/packages/promise/.0.6.6.1cqifiz++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/lib/core.js:45:5)
from qualityfaster.
that's the file:
fixtures.common = {
reset: function () {
// make sure the DDP connection is not logged in before clearing the database
server.call('logout');
server.execute(function () {
Package['xolvio:cleaner'].resetDatabase({});
const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
});
}
};
from qualityfaster.
Install xolvio:[email protected]
Gerwin Brunner [email protected] schrieb am Do., 21. Apr. 2016,
20:24:
that's the file:
fixtures.common = {
reset: function () {
// make sure the DDP connection is not logged in before clearing the database
server.call('logout');
server.execute(function () {
Package['xolvio:cleaner'].resetDatabase({});
//Package['xolvio:cleaner'].resetDatabase({excludedCollections: ['meteor_accounts_loginServiceConfiguration']});
//const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
const { configureServices } = require('/imports/infrastructure/server/serviceConfigurations');
});
}
};—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#37 (comment)
from qualityfaster.
that did the trick!
Thanks!
from qualityfaster.
Related Issues (20)
- Custom jasmine
- Project does not run HOT 1
- Build failure on Circle CI.
- good article about testing global meteor state (methods, onCreated, helpers)
- Why is Lodash required? HOT 1
- Absolute include paths do not work HOT 4
- wallaby on server cannot understand meteor style es6 imports HOT 2
- Attempting to import from src/node_modules directory doesn't work
- Can't import { Meteor } from 'meteor/meteor'. HOT 2
- update README to reflect that Meteor 1.3 has been released
- are you leaving meteor? HOT 2
- Chrome or firefox can't find selenium on second time run HOT 7
- why mocha and not jasmine, in the dev branch? HOT 2
- Change phantomjs reference to phantom-prebuilt HOT 1
- nested imports HOT 2
- Linting issues HOT 1
- wallaby.js with meteor 1.5 HOT 3
- Meteor 1.5 problem with duplicated method and collection names
- wallaby.js with meteor 1.6 HOT 4
- update circle.yml to show v2 example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qualityfaster.