-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
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
How to use async/await syntax with this repo #65
Comments
Is there an error your hitting? Problem transpiling async/await with babel? I think there's might be a problem with your it('should wait for a child element', async () => {
await component.create(bootstrap);
const element = component.waitForElement('my-component');
expect(element.nodeName.toLowerCase()).toEqual('my-component');
}); |
I get these errors:
I don't get any transpliation errors because of async/await syntax. Also, I am using In fact, I used the same method used for creating component as in this welcome.spec.js test file which works without issues. |
Looking at the webpack sekeleton, I think the way @niieani solved it is by using jasmine async in karma-bundle.js: import {install as installJasmineAsync} from 'jest-jasmine2/jasmine-async';
installJasmineAsync(global); // enable running Promise-returning tests I tried to add these lines in the test setup.js file. "jest-jasmine2": "19.0.2" and ran Now I get these errors:
Maybe my approach is wrong, but how to get |
This
aurelia/testing
repo is based on JSPM. I am trying to getasync/await
syntax working with this JSPM setup so that we can re-write thecomponent-tester.spec.js
as the following:As you can see, using
async/await
in thebeforeEach()
eliminates the necessity to repeatcomponent.create(bootstrap).then(() => {
in all the specs. Also, callingdone()
is not required in every spec.Contrast the above code with the current code:
Note that I am aware that
async/await
setup is currently working inaurelia/skeleton
repo but I am trying to getasync/await
syntax to work with this JSPM based repo.The text was updated successfully, but these errors were encountered: