Comments (8)
You need to import the one from your app:
needs: ['metrics-adapter:piwik']
the ember-metrics@...
form will try to resolve it on the addon's namespace instead.
from ember-metrics.
@poteto Thank you for your answer. Actually, I'm unit testing this adapter, so I thought it was not a need
, but the subject of the module. I will try your suggestion tomorrow and let you know if that works.
from ember-metrics.
I tried, but it does not work. Here is the adapter:
//app/metrics-adapters/piwik.js
import PiwikAdapter from 'ember-metrics/metrics-adapters/piwik';
export default PiwikAdapter.extend({
identify(options = {}) {
this._super(...arguments);
window._paq.push(['setCustomDimension', 1, options.organizationName]);
window._paq.push(['setCustomDimension', 2, options.userId]);
}
});
and the test, using ember-mocha
/* jshint expr:true */
import { expect } from 'chai';
import {
beforeEach
} from 'mocha';
import {
describeModule,
it
} from 'ember-mocha';
describeModule(
'metrics-adapter:piwik',
'PiwikAdapter',
{
needs: ['metrics-adapter:piwik']
},
function() {
let config;
beforeEach(function () {
config = { piwikUrl: 'someUrl', siteId: 42 };
});
it('exists', function() {
var adapter = this.subject({ config });
expect(adapter).to.be.ok;
});
}
);
The following error is thrown:
Could not find module
ember-metrics/metrics-adapters/piwikimported from
frontend/metrics-adapters/piwik`
It seemed to me that I should add the dependency to the ember-metrics piwik adapter, but if I do that I have the above error, ie Attempting to register an unknown factory:
ember-metrics@metrics-adapter:piwik`
from ember-metrics.
Sorry about the delay! Can you share what your config / env looks like?
from ember-metrics.
Hi, I'm sorry for the delay. I don't know when I will go back to work (kind of burn out for the moment), but for sure, as soon as I can I will try to keep this up to date
from ember-metrics.
@poteto, having the same problem while unit testing a metrics-adapter
that I export from an addon. I added ember-metrics
in both the dependencies
and devDependencies
of my addon's package.json, and tried:
moduleFor('metrics-adapter:google-analytics', 'google-analytics metrics-adapter', {
needs: [
'service:logger',
'service:configService',
'service:metrics',
'ember-metrics@metrics-adapter:google-analytics'
]
});
Which fails with Attempting to register an unknown factory: 'ember-metrics@metrics-adapter:google-analytics'
while removing the needs: ember-metrics@metrics-adapter:google-analytics
line leads to:
Could not find module `ember-metrics/metrics-adapters/google-analytics` imported from `ember-commons/metrics-adapters/google-analytics`
my metrics-adapter itself starts with:
mport GoogleAnalyticsAdapter from 'ember-metrics/metrics-adapters/google-analytics';
import Ember from 'ember';
const {inject, copy, computed, Logger} = Ember;
export default GoogleAnalyticsAdapter.extend({
//..
and works well except for the failing test
from ember-metrics.
@poteto, forget it it was as simple as setting the metricsAdapters ENV variable in my dummy app config, thanks
from ember-metrics.
@poteto I'm sorry letting this one so long. If you still interrested I could work on, otherwise I will juste close. Your call 😺
from ember-metrics.
Related Issues (20)
- Resolve ember-beta and ember-canary fails HOT 2
- Deprecate EmberObject Usage? HOT 15
- 😍 TypeScript 😍 HOT 1
- [1.3.0] GoogleTagManager script tag included twice HOT 2
- NOTICE: Intent to rename primary branch HOT 2
- Deprecate Metrics Service `options`
- Support Embroider optimized HOT 2
- Outdated metrics-adapter test blueprint
- Investigate spurious facebook adapter fail
- Refactor Adapter Hook Methods HOT 6
- Support for Google Analytics 4 HOT 7
- Modernize Segment Tests
- `this._adapters` is not iterable in `willDestory` hook
- Breaking changes in 1.4.x HOT 2
- Why does the GTM adapter rewrite top-level event schema in trackEvent? HOT 5
- Release 1.5.0 accidentally shipped breaking changes meant for v2? HOT 5
- deprecation message says "This will be removed in Ember 2.0.0"
- Google Tag Manager Crossorigin
- SetCustomVariables for Piwik adapter
- Metrics adapters no longer inject services.
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 ember-metrics.