Remove JSPM from dependencies - karma-jasmine

We have developed a single page application using aurelia+type script+jspm.Our purpose is remove the jspm packages from the project. We have using karma framework for unit testing. We have successfully removed all jspm dependency.We have copied the necessary packages from jspm_packages folder and pasted into new location. The application is working properly. But now when we run the karma unit testing, it cause "System is not defined" error is showing on the console.
The config.js configuration
paths: {
"*": "src/*",
"github:*": "Scripts/github/*",
"npm:*": "Scripts/npm/*"
}

Related

gradlew clean deployNodes - QUASAR WARNING: Quasar Java Agent isn't running

When I run "gradlew clean deployNodes" or "gradlew deployNodes", I get a warning on Quasar library:
QUASAR WARNING: Quasar Java Agent isn't running. If you're using another instrumentation method you can ignore this message; otherwise, please refer to the Getting
Started section in the Quasar documentation.
How can i fix this warning ?
I upgraded Corda to 4.1
you'll want to double-check the intellij settings.
Navigate to Build, Execution, Deployment -> Build Tools -> Gradle ->
Runner (or search for runner) Windows: this is in "Settings" MacOS:
this is in "Preferences" Set "Delegate IDE build/run actions to
gradle" to true Set "Run test using:" to "Gradle Test Runner" If you
would prefer to use the built in IntelliJ JUnit test runner, you can
run gradlew installQuasar which will copy your quasar JAR file to the
lib directory. You will then need to specify -javaagent:lib/quasar.jar
and set the run directory to the project root directory for each test.
As mentioned in the comments from manish, make sure to try cleaning the gradle cache as well: ./gradlew clean build deployNodes.
Joel has a good answer for a similar quasar issue on this StackOverflow question: Error when running Corda flow tests from IntelliJ

prevent aspnet core webpack middleware from doing a first-run webpack build

I'm running into an issue where if I change and save any c# code in a dotnet core Asp.Net application (for example within a controller) while running a "start without debug" session in visual studio, it will run a first-run Webpack build, even if no javascript code is changed:
1>Performing first-run Webpack build...
1>Hash: e3e29292b63fc407c658
1>Version: webpack 3.11.0
1>Child
This makes it really slow to make changes to dotnet code. However, if I am working on just javascript code (vue files for instance), the Hot Module Replacement works well and it updates very quickly without doing a full webpack build.
I am working on an application which I haven't ported to Webpack 4 yet, but I was wondering if this is something to do with my asp.net configuration.
I am using the following in my startup.cs, before a call to app.UseStaticFiles();:
if (env.IsDevelopment())
{
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
});
}
Is there a way to prevent the first-run webpack build if there are no changes to javascript files? It seems like the webpack build should be called by dotnet only if there are changes in javascript files, not in pure c# code.

Yeoman custom generator automatically install gulp + dependencies when creating new project

I'm brand new to Yeoman and even Gulp. I'm making websites that are very similar between them, so I'm trying to create a custom generator for Yeoman. I've managed to make template html files, and to copy over both files and folders when running the generator.
I made template package.json and gulpfile.js files with dependencies that all projects will be using, such as gulp, gulp-sass, gulp-autoprefixer, etc. My question now is: How do I make the generator automatically install npm and all dependencies when I run it in a new project? Or do I have to run npm install --save-dev *** for each dependency every time I create a new project?
Add the dependencies in the package.json files inside your generator.
For example https://github.com/yeoman/generator-node/blob/master/generators/gulp/index.js#L42 (there's other way to do this too. It depends on your needs)
Then you just call this.installDependencies().
You can also invoke commands:
generator.spawnCommandSync("bower", ["install"]);
generator.spawnCommandSync("npm", ["install"]);

How to test files that use browserify-shim global's in Jest?

I'm downloading the google maps API v3 via a script tag, and I'm adding the dependency to my modules with the following (relevant) package.json configuration:
"browserify-shim": {
"google": "global:google"
}
And I can add the dependency in my files with the following:
var google = require('google');
When I run my code in the browser, it works fine.
The problem is, when I run my tests with Jest, it tells me that it can't find the 'google' module:
Error: /src/app/assets/javascripts/__tests__/helpers-test.js: Cannot find module 'google' from '/src/app/assets/javascripts/__tests__'
Note:
This dependency is being required in the file that I'm testing, not the test itself. I find this confusing since I thought that Jest mocks all dependencies unless it is specified otherwise, but from what I can see, it first needs to correctly satisfy the dependencies before mocking.
Any ideas of what am I missing or what approach should I take?
You'll need to alias 'google' properly in your package.json, see here.

Debugging mocha tests run by gulp in Intellij Idea

I have the following configuration in my gulpfile.js:
gulp.task('spec', function() {
gulp.src('spec/runner.html')
.pipe(mocha({reporter: 'dot'}))
})
When I run nodejs inside IntelliJ Idea, the scripts files imported by spec/runner.html are not loaded by the IDE and therefore the breakpoints are ignored. Is there a solution to this?
In your run configuration options, for "JavaScript file" put the value:
node_modules/gulp/bin/gulp.js
Then put your gulp parameters in the "Application parameters".
WebStorm 9 EAP has native gulp integration, but this works until that is final.