We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to use an aspect defined in an external file & failing.
Failing test can be found at https://github.com/SciSpike/aspect.js/blob/external-aspects/test/advices/sync_advices.spec.ts#L305 (that's in forked repo https://github.com/SciSpike/aspect.js, branch external-aspects).
external-aspects
Code is effectively
// in file external_aspect.ts import { aroundMethod, Metadata } from "../../lib"; import { expect } from "chai"; export default class ExternalAspect { @aroundMethod({ classNamePattern: /.*/, methodNamePattern: /.*/ }) around(metadata: Metadata) { expect(this).to.deep.equal(ExternalAspect.prototype); expect(metadata.className).to.equal('Demo'); expect(metadata.method.name).to.equal('get'); expect(metadata.method.args).to.deep.equal([42, 1.618]); expect(metadata.method.invoke).to.be.a('function'); metadata.method.proceed = false metadata.method.result = 'ExternalAspect' } }
Failing test code is
import ExternalAspect from './external_aspect' // ... describe('AroundAdvice', () => { // ... it('should invoke the external advice with the appropriate metadata', () => { let demo: any; @Wove() class Demo { get(foo: any, bar: any): string { return 'Demo' } } demo = new Demo(); expect(demo.get(42, 1.618)).to.equal('ExternalAspect'); }); }); // ...
Created similar test using inline aspect that's passing at https://github.com/SciSpike/aspect.js/blob/external-aspects/test/advices/sync_advices.spec.ts#L279.
The text was updated successfully, but these errors were encountered:
Everything works properly in the example I just pushed.
Sorry, something went wrong.
Ok. It looks like the key difference is that instead of using
import ExternalAspect from './external_aspect'
The form of the import statement needs to be
import
import './external_aspect'
Case closed! :)
#66 proves this
No branches or pull requests
Trying to use an aspect defined in an external file & failing.
Failing test can be found at https://github.com/SciSpike/aspect.js/blob/external-aspects/test/advices/sync_advices.spec.ts#L305
(that's in forked repo https://github.com/SciSpike/aspect.js, branch
external-aspects
).Code is effectively
Failing test code is
Created similar test using inline aspect that's passing at https://github.com/SciSpike/aspect.js/blob/external-aspects/test/advices/sync_advices.spec.ts#L279.
The text was updated successfully, but these errors were encountered: