Getting error while write test case for render in Mocha - meteor

I have an Meteor project using BlazeJS. I am writing test case for that project in Mocha for rendering. And i am facing below error:-
Error: No such function: _
at blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3214
at Spacebars.call (spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172)
at Spacebars.mustacheImpl (spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:106)
at Object.Spacebars.mustache (spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:110)
at Blaze.View._render (app.js?hash=5f5e88169d987fce5c1c7e49f67c237d33b43cb9:514)
at Blaze.View.doRender (blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2086)
at blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934
at Function.Template._withTemplateInstanceFunc (blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744)
at blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932
at Object.Blaze._withCurrentView (blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271)
Please advise how I resolved above error.

Related

Failed to compile. static/css/main.b6d8a2cb.css from Css Minimizer plugin TypeError: Cannot set properties of undefined (setting 'value')

PS C:\Users\Hp\Desktop\web technology\NCT\carrental> npm run build
carrental#0.1.0 build
react-scripts build
Creating an optimized production build...
Failed to compile.
static/css/main.b6d8a2cb.css from Css Minimizer plugin
TypeError: Cannot set properties of undefined (setting 'value')
the react app runs fine on the development server but shows this error when I try to build it for production ready. crosses checked 100 times, nothing seems to work. the static/css/main.b6d8a2cb.css isn't part of my project.

Error in ng serve command. ./ node module/#angular-devkit/build

node version 14.15.0 and angular version 12.0.5;
earlier it worked fine but after reinstallation of angular and nodejs it shows this error on ng serve command.
ERROR in ./src/assets/styles/style.scss (./node_modules/#angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js??ref--15-3!./src/assets/styles/style.scss)
Module Error (from ./node_modules/postcss-loader/src/index.js):
(Emitted value instead of an instance of Error) CssSyntaxError: D:\node-v15.11.0-win-x64\ssc1\src\assets\styles\icons\material-design-iconic-font\css\materialdesignicons.min.css:1:86: Can't resolve '..//fonts/materialdesignicons-webfont.eot' in 'D:\node-v15.11.0-win-x64\ssc1\src\assets\styles\icons\material-design-iconic-font\css'
If anybody know the solution please tell me how to solve this issue
image of error here

TypeError: module.exports.v1 is not a constructor, error thrown from google-cloud/firestore when using firebase-admin sdk

Recently I encountered the above error (TypeError: module.exports.v1 is not a constructor) when trying to run firebase-firestore related tests. Earlier I had no issue running the tests but after doing a npm install was getting the above error.
The source of the error is from google-cloud/firestore which is required by firebase-admin.
Tried several options but it doesn't seems to get resolved. I then tried with an older node-module and it worked as expected.
The problem was due to the test framework I've been using. Once I changed from jest to mocha the problem got solved.
When I updated firebase admin sdk from 8.4.0 to higher then I had same error in running jest test code.
I fixed it to add --env node option for jest.
jest --env node
I hit this error when I left out an await on an async function. That caused my code to continue running after the jest environment had been torn down.
There was a message that said ReferenceError: You are trying to import a file after the Jest environment has been torn down. which should have been a tip that I was running async code and not waiting for completion.
We needed to upgrade node from v8.11.3 to v8.16.2.

Mocha coverage task fails and propagates exception to grunt which aborts the whole execution

I am using grunt-mocha-istanbul and have a task which runs the coverage through set of test files. The reporter is set to mocha-junit-reporter which generates the mocha test results XML file and the coverage report formats are set to cobertura and html.
For some reason, an error in the tests causes the whole task to fail and not just to get details on the failed test in the end report.
I ran the grunt task using --stack argument which produced the following:
Error: Task "mocha_istanbul:coveralls" failed.
at Task.<anonymous> (~\node_modules\grunt\lib\util\task.js:205:15)
at null._onTimeout (~\node_modules\grunt\lib\util\task.js:241:33)
at Timer.listOnTimeout (timers.js:92:15)
As you can see, this hides the original error somehow.
I defined a separate task to just run the tests and saw the issue but it has nothing to do with how the test execution in terms of callbacks gets handled.
So my question is, how can I intercept such propagated exceptions and provide more detailed information on what actually happened?

Why does grunt.loadNpmTask('grunt-contrib-jshint') trigger an error in Sails.js?

This seems pretty straightforward, but I can't seem to debug this error. I've added this code to my Sails API as /tasks/config/jshint.js
module.exports = function(grunt) {
console.log(1);
grunt.config.set('jshint', {
files: {
src: ['api/services/*.js', 'api/policies/*.js', 'api/controllers/*.js']
}
});
console.log(2);
grunt.loadNpmTask('grunt-contrib-jshint');
console.log(3);
};
Now, when I execute any grunt task, I get an error message (but the older tasks still execute successfully).
C:\dev\fo-rest-api>grunt aglio
1
2
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Running "aglio:your_target" (aglio) task
...
Done, without errors.
When I run the jshint task, I get the same loading error and the task is aborted.
C:\dev\fo-rest-api>grunt jshint
1
2
Loading "Gruntfile.js" tasks...ERROR
>> TypeError: undefined is not a function
Warning: Task "jshint" not found. Use --force to continue.
Aborted due to warnings.
C:\dev\fo-rest-api>
A few other notes:
Using --force only changes the wording of the error message.
grunt-contrib-jshint seems to be successfully installed in /node_modules (I deleted everything and re-ran npm install to be sure.
I'm running this on Windows, if that matters. I've tried opening the command line as both a normal user and as administrator.
I tried commenting out the loadNpmTask line to see if sails would load it automatically, but still got Warning: Task "jshint" not found.
Thanks for any clues you might have.
The answer was pretty straightforward. I somehow deleted the s at the end of grunt.loadNpmTasks. When I added it back, everything worked well.
I wish there was some sort of syntax highlighting that for common packages like grunt that would identify this kind of typo...

Resources