Unable to run unittest that contain ValidationRules
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript, webpack
Research direction
Start with src/app.ts and the updated spec in the linked reproduction repository, then run au test to reproduce the ValidationRules failure. Trace the reported call into aurelia-validation.js and compare the test setup with the application setup. Done means the component test runs without the accessor parsing exception.
Written by the indexing model from the issue text.
Description
I'm submitting a bug report
- Library Version:
1.0.0
Please tell us about your environment:
-
Operating System:
Windows 10 -
Node Version:
V10.16.0
- NPM Version:
6.9.0
- JSPM OR Webpack AND Version
webpack 4.34.0
-
Browser:
n/a -
Language:
TypeScript 3.1.2
Current behavior:
When running a test that tests a component which uses ValidationRules, the following error pops up:
------------------------------------------------
Inner Error:
Message: Unable to parse accessor function:
function (a) {
/* istanbul ignore next */
cov_q8rv1u7dl.f[2]++;
cov_q8rv1u7dl.s[5]++;
return a.message;
}
Inner Error Stack:
Error: Unable to parse accessor function:
function (a) {
/* istanbul ignore next */
cov_q8rv1u7dl.f[2]++;
cov_q8rv1u7dl.s[5]++;
return a.message;
}
at getAccessorExpression (node_modules/aurelia-validation/dist/commonjs/aurelia-validation.js:113:15)
at PropertyAccessorParser.Object.<anonymous>.PropertyAccessorParser.parse (node_modules/aurelia-validation/dist/commonjs/aurelia-validation.js:95:28)
at FluentEnsure.Object.<anonymous>.FluentEnsure.ensure (node_modules/aurelia-validation/dist/commonjs/aurelia-validation.js:1703:42)
at Function.Object.<anonymous>.ValidationRules.ensure (node_modules/aurelia-validation/dist/commonjs/aurelia-validation.js:1770:58)
at new App (src/app.ts:219:42)
at Object.invoke (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:379:24)
at InvocationHandler.Object.<anonymous>.InvocationHandler.invoke (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:352:28)
at Container.Object.<anonymous>.Container.invoke (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:538:28)
at ProviderResolver.get (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:2305:72)
at Container.Object.<anonymous>.Container.get (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:493:28)
End Inner Error Stack
------------------------------------------------
at new AggregateError (node_modules/aurelia-pal/dist/commonjs/aurelia-pal.js:37:11)
at Container.Object.<anonymous>.Container.invoke (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:541:19)
at ProviderResolver.get (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:2305:72)
at Container.Object.<anonymous>.Container.get (node_modules/aurelia-dependency-injection/dist/commonjs/aurelia-dependency-injection.js:493:28)
at Container.elementContainerGet [as get] (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:2360:15)
at HtmlBehaviorResource.create (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:4379:56)
at applyInstructions (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:2470:31)
at ViewFactory.create (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:2691:7)
at TemplatingEngine.enhance (node_modules/aurelia-templating/dist/commonjs/aurelia-templating.js:5227:24)
at node_modules/aurelia-framework/dist/commonjs/aurelia-framework.js:176:28
I have searched for a proper way to unittest this, but I'm unable to find a solution. Hopefully the community can help me out.
What is the expected behavior?
A possibility to run unittest that contains ValidationRules without it throwing an exception.
I have created a public repo where you can find all the files necessary: https://github.com/JordyThien/aurelia-unittest-validation-rules
Basically I created a new aurelia project using the aurelia CLI: au new aurelia-testing --unattended --select typescript,jest,vscode --here
I've updated the https://github.com/JordyThien/aurelia-unittest-validation-rules/blob/master/src/app.ts to contain ValidationRules
And I updated the spec to add aurelia-validation
Where running the tests using au test the exception will be thrown.
- Dominant language
- TypeScript
- Stars
- 38
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aurelia/testing
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·