It gave me this error:
Chrome 37.0.2019 (Mac OS X 10.9.3) ERROR
Uncaught ReferenceError: getJasmineRequireObj is not defined at /Users/Lucia/Desktop/test-yo-karma/dev/vendors/jasmine/src/core/Spec.js:1
But I made sure the file did exist. And couldn't find the error anywhere?
I found i had
frameworks: ['jasmine', 'jasmine-ajax'],
instead of
frameworks: ['jasmine-ajax', 'jasmine'],
in my karma.conf
Just spent a good 4 hours dealing with the same issue. There are several things going wrong here (hence all the different, probably equally accurate answers), the core of it being: there are version conflicts requiring specific dependencies for 'jasmine', 'jasmine-ajax', and 'karma-jasmine-ajax'.
I use Jasmine 1.3, and the current version of karma-jasmine-ajax depends on a version of jasmine-ajax that is incompatabile with Jasmine 1.3.x.
This is noted in the jasmine-ajax documentation, but not the karma-jasmine-ajax documentation: "This branch is now version 2.0, if you need jasmine-ajax for Jasmine 1.3.x please grab the last release from that tag."
In order to fix this specific conflict, I specified "karma-jasmine-ajax": "0.1.3", in my package.json, which pulls in jasmine-ajax version 2.0.0. This version of jasmine-ajax does not use getJasmineRequireObj.
If you're loading in jasmine-ajax directly, you can use this version: https://raw.github.com/pivotal/jasmine-ajax/v1.3.1/lib/mock-ajax.js
Keep in mind (yet another gotcha) that the different versions of jasmine differ in their usage of request.response and request.RespondWith -- and this switches back and forth between older and newer versions.
Hope this helps.
Originally I had this in karma.conf.js:
files: [
{pattern: 'dev/vendors/**/*.js', included: false},
{pattern: 'dev/scripts/**/*.js', included: false},
{pattern: 'test/**/*Spec.js', included: false},
'test/test-main.js'
]
It turns out,
the order of files included matters
you're not supposed to include irrelevant files (e.g. the whole of /vendors)
So I should include separate files, in their order of dependency instead.
[The unhelpful documentation]
i saw this error as well, and when i looked through it, it turned out that var TEST_REGEXP in karma.conf.js was too broadly defined and was actually grabbing and executing: my_client/app/bower_components/jasmine/src/core/Spec.js:1
once i changed my TEST_REGEXP to include only my specs (you could also do this by specifically excluding all spec files of vendor directories) the error went away.
Related
Hello developers out here!
I struggle with stencil bundle and stencil push issues.
I get error at "Validating theme..."
Error: Your theme's schema.json has errors:
schema[1].settings[28].options[0].value should be string,number
schema[1].settings[28].options[1].value should be string,number
...
It seems that I get this issue after try to test latest cornerstone (5.4.5) theme version, and update stencil-cli and now I can't use oldest version (1.10.0) schema.json file -> https://github.com/bigcommerce/cornerstone/blob/1.10.0/schema.json
Now it only works with these two files:
schema.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schema.json
schemaTranslations.json -> https://github.com/bigcommerce/cornerstone/blob/4.5.4/schemaTranslations.json
But I am not sure how it would impact live site work if I use different schema files.
It is possible to work again with old schema.json file?
Previously all worked...
I tried to:
delete all node_modules
reinstall #bigcommerce/stencil-cli
and node modules (npm install)
These look similar to errors when the schema.json or schemaTranslations.json file have been removed or modified, could you add any relevant schema code in your post? Since Stencil CLI 2.0, part of the bundle process now validates a schemaTranlsations.json file which has been included since Cornerstone 4.5.4. This change can be found on the GitHub repo here as well as on our DevCenter Changelog.
Hello #dakterits and #kyle-obrien
The error which you mentioned means that option number 0 and 1 in setting number 28 in the schema file has either empty value or different value. So, to fix this issue, you don't have downgrade the node or reinstall stencil or delete any file.
The Solution:
Download the original copy of the theme.
Edit the original theme schema file.
If you have any file compare software then compare edited theme schema with original theme schema.
Once you compare, you will definitely see any change in value in defined settings.
Situation
So I have a .babelrc like this:
{
"presets": [
"es2015",
"stage-2",
"react"
],
"plugins": [
"transform-decorators-legacy"
]
}
Question
What is the difference between presets and plugins? Which one should I use to configure Babel?
tl;dr
Presets are just a collection of plugins. You can include plugins individually in the plugins array, or collection of plugins in the presets array. If a plugin is part of a collection (preset), you don't have to include it individually in plugins.
The same goes for npm packages when you include them in package.json.
Presets vs Plugins
Babel has lots of official and third party plugins. Presets are collections of plugins or as they say:
Presets are sharable .babelrc configs or simply an array of babel plugins.
An important difference between the two is that plugins are loaded before presets.
Plugins of a preset
The most common presets are the official ones and the discontinued experimental presets.
Most of the official presets contain plugins to transpile features of the EcmaScript standards, while the experimental (stage-x) presets contained plugins that transpiled future experimental features whose standardization is still a work in progress. These experimental/proposal presets are deprecated since Babel 7. They have a blog entry on the reasons. Read the section below to see how they worked.
When you click on a preset, you can see which plugins (and maybe other presets) are included in it. If you include a plugin via a preset you don't have to include it individually. The same goes for package.json when you include the npm packages of the presets.
Deprecated proposal preset system
Going from stage 0 (just an idea) to stage 3 (candidate) you had collections of plugins that were more closer to getting standardized. Because of this, when you included a preset, every preset with a higher stage-x value were included too. The plugins contained in these presets were continuously varying in each version, since they are a work in progress, and there is a chance that plugins will be removed if they got rejected. That is why you needed transform-decorators-legacy because, decorator transpiling was earlier removed from Babel, although they added it back later.
Migrated existing webpack project to use webpack 3.5.5 and its new config. Using express server instead of webpack-dev-server.
I had to setup the resolve in webpack as below.
const resolve = {
extensions : ['.js'],
modules : [
'node_modules',
'src',
'testApplication'
]
};
When i debug this webpack application using chrome developer tools I can see the 2 versions of source files.
The first one under webpack://
It is exactly matching with the source
The second one under webpack-internal://
This one is the babel compiled version of the source.
My questions are
Is there someway where I get only a first version of the file instead of both?
I thought node_modules should have been implicitly defined as a module rather than me specifying it explicitly in resolve, is there someway that I can make the build work without having the node_modules defined in resolve.
After using the same source code with webpack 3.5.5(migrated it from webpack 1.14.0) the express server start seems to have slowed node. My guess is that having specified the node_modules in modules under resolve has caused it. Any ideas?
You can configure the source maps using Webpack's devtool property. What you want is devtool: 'source-map'(source). This will only show you the original source code under webpack://. Note that there are other options that might be more appropriate for your use case.
["node_modules"] is in the default value for resolve.modules. However, if you specify resolve.modules you need to include "node_modules" in the array. (source).
It seems strange that you specify "src" and "testApplication" in resolve.modules. If you have local source files you should require them using relative paths e.g. require("./local_module"). This should work without having src in resolve.modules
Specifying node_modules in resolve.modules is not responsible for any slow down (see 2.). There are many possible reasons the slow down. E.g. maybe you are erroneously applying babel to the whole node_modules folder?
It seems to be resolved (or at least greatly improved) in Chrome 66.
I am struggling to understand how to include Angular 2, a massive framework, into my content script.
My main concern is that every file needs to be included in the content script / manifest.json file. I have tried different variations, but I fail with obscure error messages every time.
I have tried to find some instructions on the internet, but to no avail. The best resource I found was https://www.devbattles.com/en/sand/post-3072-Build_Your_Own_Chrome_Extension_Using_Angular_2__TypeScript but it does not seem to be about content scripts, rather it is about having an isolated webpage. It is also a bit outdated.
This is me struggling with the manifest.json file.. (partial)
{
"matches": [ "https://hp.my.salesforce.com/console*", "https://hp.my.salesforce.com/ui/support/servicedesk/ServiceDeskPage*" ],
"js": [
"ze_modules/systemjs/dist/system.js",
"ze_modules/rxjs/bundles/Rx.js",
"ze_modules/#angular/core/bundles/core.umd.js",
"ze_modules/#angular/common/bundles/common.umd.js",
"ze_modules/requirejs/require.js",
"settings-ui/test.component.js",
"console/includes/jquery-2.2.3.min.js",
"console/includes/toastr.js",
...
...
Does anyone have any pointers? How do I get require to work? How do I get SystemJS to work? It's all a big blur for me.
I've had no issues developing the extension so far, by manually and hastily including some js libs in the manifest.json, but this is just an extreme amount of files.
Some of the error messages..
Uncaught TypeError: Cannot read property 'Subject' of undefined(anonymous function) # core.umd.js:9194(anonymous function) # core.umd.js:14(anonymous function) # core.umd.js:15
common.umd.js:14 Uncaught TypeError: Cannot read property 'Observable' of undefined(anonymous function) # common.umd.js:14(anonymous function) # common.umd.js:15
require.js:168 Uncaught Error: Module name "#angular/core" has not been loaded yet for context: _. Use require([])
http://requirejs.org/docs/errors.html#notloaded
So what I learned here is that chrome extensions differ from regular web development in two major ways:
Everything follows CSP policy, meaning dynamic evaluation is more limited and will cause you pain depending on which libraries you want to use (Angular for example, unless you want to utilize AoT which is still beta)
Files you use need to be declared in the manifest.json file.
I'm not going to document everything I've learned in how to do the above, but basically you need to get into using Webpack. If you want to use Angular 2 like in my case, you need to use Webpack 2.x and Angular 2.x along with AoT compilation (using angular cli).
Webpack helps you because it bundles all your work into single files, which are a lot easier to declare in your manifest.json file(s, you can have several using webpack config).
I downloaded the ArticleComments.php from the homepage, and have copied it to my extensions directory.
I add this line to the end of my LocalSettings.php :
require_once( "extensions/ArticleComments.php" );
But when I do, it knocks my wiki over until I disable it!
The PHP error log says:
Fatal error: Call to a member function addMessage() on a non-object in /opt/bitnami/apps/mediawiki/htdocs/extensions/ArticleComments.php on line 277
where line 277 reads:
$wgMessageCache->addMessage('article-comments-name-string', 'Name');
Any ideas? This is a common extension, and I just don't know why I can't get it to work? Can anyone link me to the correct file / download in case my PHP file is corrupt in some way? Any info would be useful, I'm tearing my hair out!
Apparently, the version of the ArticleComments extension available from the "official homepage" (0.4.3) is pretty badly outdated, and doesn't work with MediaWiki 1.16 or later. There's a more up-to-date version (0.6) available in the Wikimedia SVN repository which fixes a number of incompatibilities and, according to the change log, a few security issues as well.
(The specific reason for the crash you got is that the global $wgMessageCache object, which the old version uses to define its interface message, was removed in MW 1.18. However, looking at the change log, there seem to be several other incompatibilities as well.)
The mediawiki.org page for the ArticleComments extension is currently really confusing: it contains links to the up-to-date version in the infobox, but everything else on the page links to the old version. I really should contact the maintainers of the extension and try to get it straightened out.