I'm using gulp-karma + mocha + chai + sinon in order to unit test some front end.
The nasty thing I keep getting into is the "Script Error" message that karma spits out without any other relevant detail.
How can I make karma display the source of the error also ?
This might be a little late, but as others may find this problem I thought I'd add some notes.
The Script error comes when the error is produced in a different domain than it's consumed. Browsers then remove the error details for security reasons. Typically this happens if:
you load scripts/pages from different domains
you run eval code. Note that this is what webpack often does in development scenarios
To mitigate this you can
add relevant HTTP CORS headers
skip running eval code - if you're running webpack, choose a devtool not containing "eval"
load resources from the same domain
Hope it helps
Related
I am new to the Design Automation API, so please excuse and correct me if I am using the wrong terms. I am setting up the wiring for my very first Design Automation AppBundle, and I have almost all of it working. I followed the patterns in the "Delete Walls" tutorial.
I have a working add-in DLL that I can test locally and it runs under the "design.automation-csharp-revit.local.debug.tool".
I also have all of the Rest API connections setup, and I can successfully submit a WorkItem that will download a Revit file from a BIM 360, and start processing it in the sandbox of Design Automation. But I am getting an error during the execution on the sandbox where it seems it can't find my add-in file. Here is an excerpt from the WorkItem log:
[07/21/2020 18:02:26] Resolving location of Revit/RevitCoreEngine installation...
[07/21/2020 18:02:26] Running user application....
[07/21/2020 18:02:31] Cannot find the addin file:
[07/21/2020 18:02:31] Fail to deploy Addon DLL(s) in AppPackages.
[07/21/2020 18:02:31] RESULT: Failure
I have looked through "bundle" ZIP file many times looking for typos that could cause this, but I can't find anything, it looks identical to the "delete walls" example. So I'm wondering if there is somewhere else that I need to look. Or any other way I could debug this to find out were the connection is missing. I can only assume that the AppBundle and Activity items are setup correctly since I am getting this far and the error is not mentioning either of those items.
Any tips on where to look?
This turned out to be a misspelling of the [dot]bundle folder extension that triggered the issue.
I'm following the TypeScript create-react-app tutorial and I managed to get Jest + enzyme working through the command line, but I'd also like to be able to test single functions and whatnot inside of PhpStorm. However I keep getting the following error when running through PhpStorm:
Error: An error occurred while adding the reporter at path "/snap/phpstorm/36/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-reporter.js".Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
What should my test setup/configuration look like? I can't seem to find any examples in the PhpStorm Docs or otherwise. Thanks!
Currently, I am in the middle of migrating my iOS app from api.parse.com to my own server. In the guide I am following, I am at the point where I need to test the app's functionality with a local Parse Server. Although, setting up a custom Parse Server requires having the latest Parse-SDK, and I am running an older version. I am trying to update my frameworks via CocoaPods. My Podfile is as follows:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MYAPP' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MYAPP
pod 'ParseFacebookUtilsV4'
pod 'Parse'
#pod 'ParseTwitterUtils'
pod 'ParseCrashReporting'
pod 'ParseUI'
target 'MYAPPTests' do
inherit! :search_paths
# Pods for testing
end
end
When I try running the app, I get the following error:
duplicate symbol _PFConfigParametersRESTKey in:
/Users/ME/Library/Developer/Xcode/DerivedData/MYAPP/Build/Products/Debug-iphoneos/Parse/libParse.a(PFConfig.o)
/Users/ME/Library/Developer/Xcode/DerivedData/MYAPP/Build/Products/Debug-iphoneos/Parse/libParse.a(PFConfigController.o)
duplicate symbol _PFConfigParametersRESTKey in:
/Users/ME/Library/Developer/Xcode/DerivedData/MYAPP/Build/Products/Debug-iphoneos/Parse/libParse.a(PFConfig.o)
/Users/ME/Library/Developer/Xcode/DerivedData/MYAPP/Build/Products/Debug-iphoneos/Parse/libParse.a(PFCurrentConfigController.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've been searching for something online to help, but nobody seems to be experiencing this problem. I think my case is unique, as I have yet to see someone who has two duplicate errors on the same symbol pointing to the same archive(libParse.a) with one shared file (PFConfig.o) and two differing ones (PFConfigController.o and PFCurrentConfigController.o). I've implemented a variety of solutions that would generally solve this "duplicate symbol" error, but I haven't had any success.
Things I have done:
Ensured that all manually added versions of these frameworks have been removed from the project.
Scanned the project directory up and down multiple times via Finder/Command Line/grep/find and could not find any duplicated frameworks.
Ensured I did not add any "import *.m" files accidentally.
Checked for red files/duplicates in the Frameworks folder as well as the "Link Library With Libraries" section of "Build Phases."
Checked my framework, header, and other linker paths and they seem to be alright. My "Other Linker Flags" contains "$(inherited)" and a -force_load call to a third party ".a" file for analytics.
Cleared ~/Library/Developer/Xcode/DerivedData as well as removed Pods/ and ran "pod install" multiple times.
I went on to investigate the problem in the Parse files. The only place where PFConfigParametersRESTKey is defined is here and here. This seems alright since one of them is preceded by the extern keyword(reference here). I tried messing with the source files a little bit by making this variable not static and also trying to rename one of them. Nothing worked. I cannot figure out where to look to fix this.. If anybody can shed some light here I would greatly appreciate it! Thank you.
The solution to my problem was to remove an -ObjC flag from the linker config. For some reason, -ObjC was not one of the entries in the Linking section of Build Settings. The way I found it was by going to Pods/Pods-MYAPP.debug.xcconfig, and manually removing the -ObjC flag from the OTHER_LDFLAGS variable.
Is there any way to stop Karma &/or Protractor from linting files in the stream passed to it? We are using gulp, but this could probably apply to other automation tools/environments. While I am sure they are just trying to be helpful, this clogs up our console and is redundant. Worse, it can be confusing to see the same error twice.
Here is an example task:
var karma = require('karma').server;
var spawn = require('child_process').spawn;
gulp.task('tests', function() {
karma.start({
files = 'my/unit/test/files/*.spec.js',
singleRun: true
}, function(error) {
if(error) {
console.log(error);
}
});
spawn('protractor', ['--specs=my/e2e/test/files/*.e2e.js'],
{stdio: 'inherit'}
);
});
If the file "my/e2e/test/files/test.e2e.js" exists & has a JSHint error, Protractor will report the error, whether or not you also run gulp-jshint or something else.
As an example, if the file "my/e2e/test/files/test.e2e.js" looked like this:
describe('some test', function() {
);
The output of gulp tests might look like this:
... some setup...
Protractor:
[09:32:30] An error occurred during the end-to-end testing run
[09:32:30] my/e2e/test/files/test.e2e.js:3
);
^
... some Protractor tests ...
... some Karma tests ...
If the file "my/unit/test/files/test.spec.js" exists & has a JSHint error, Karma will report this error, and it will not run. For example, if the file "my/unit/test/files/test.spec.js" looks the same as "my/e2e/test/files/test.e2e.js" above, the output of gulp tests may look like this:
...some setup...
Karma (I think):
PhantomJS 1.9.8 (Linux) ERROR
SyntaxError: Parse error
at my/unit/test/files/test.spec.js
SUMMARY:
✔ 0 tests completed
...some protractor tests...
It seems that Karma fails the task and does not run if there is an error in the spec files passed to it, and Protractor will report the error but still run, and will report the error in the tasks contained in the errored file. I would rather both streams run, both sets of tests run completely, and perhaps report syntax errors in the test output. However, they should not report the syntax errors before the tests run, or after, because we already have gulp-jshint for linting files. This is just redundant, and it is twice-redundant, in the case of Protractor, if you have a linting plugin already.
So, back to my question: Is there any way to prevent Karma &/or Protractor from linting in their respective streams, separately from the output of the tests? Is there any way to get access to their respective error reporters, without changing their source code? I could always kill them both on any errors before they run, but I may want to run the tests anyway, and I would definitely want to run the other testing framework (for example, run Karma if there are syntax errors in .e2e.js files).
The errors that both Protractor and Karma are Error that the Javascript Engines (the browser you're using for testing) are shouting to you.
Karma and Protractor are not "linting" anything themselves.
To debug the issue in Karma follow these steps:
Add a regular browser to the karma configuration: instead of PhantomJS use either Chrome or Firefox
Start the karma server (not the runner): in your Gulpfile.js change singleRun from true to false.
Once karma and your browser have started you should have a similar window:
Now click on the DEBUG button, it will open a new tab, where you can open the Dev Tools (in case you're using Chrome):
In the Javascript console now you should be able to see that Syntax Error "Karma is reporting" (effectively karma is just repeating what Phantom is trying to say)
Solve those issues and then try to run again in the browser.
Once everything has been fixed switch back to PhantomJS and singleRun: true.
It's not about linting, it's about having understandable/parsable code.
Your example file "my/e2e/test/files/test.e2e.js" is not well written, you're missing function close. Some errors can be "understood" by karma, protractor or your browser, like a missing semicolon.
But errors like not closing a function breaks the parsing of the file and parser won't understand what you mean.
Having such code in a website would break the rendering and result in not running.
It's a follow-up from this.
Windows Phone 8 C# project (MyApp), migrated from WP7.1. I've added a native Windows Runtime component library (AppLib) to the solution, created a reference. There's a public sealed ref class (MyClass) in it. There's a reference to it in the C# code (in OnLoaded of the main XAML page). The whole thing builds - meaning the metadata of the component is being generated.
When I'm trying to run on the emulator, the project fails with the exception or type BadImageFormatException with the following message:
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
The error typically pops up when you try to mix CPU types in .NET.
The active platform is "Mixed platforms". In the Configuration Manager, it's configured to build MyApp for "x86" and AppLib for "Win32". In a vanilla freshly generated project that runs fine, the config is identical.
Question - what's wrong with that configuration? What do I need to check?
EDIT: I've added a second, blank C++ library to the solution - TestLib. This one loads and works as expected.
EDIT2: excluded everything from build in AppLib - it works. Now I'll be adding lines one by one, see which one causes the issue...
Totally my fault. When I changed the namespace of AppLib (see the linked question), I've left one little declaration in the library in a MyApp namespace.
The error is still misleading. I'd delete the question, but since the error message is sure to send someone on a wild goose chase with build CPU type and whatnot, let it remain.
Shouldn't a Windows Phone library be built for ARM in most cases? Have you had a chance to watch the "Windows Phone 8: Using C++ in your Applications" session from last week's //Build/ conference? That might include some answers.