![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
gulp-jest-jspm-es5
Advanced tools
Gulp plugin for running Jest tests on JSPM/SystemJS apps in older versions of node
This library is a backport of (https://github.com/yoavniran/gulp-jest-jspm) because I needed it on older versions of NodeJS that didn't support some of the newer ES6 syntax that was being used. If you don't run an older version of Node it probably makes more sense to use that version of the library.
Gulp plugin for running Jest tests on JSPM/SystemJS apps
Reason: In case you're building an app with JSPM/SystemJS you are probably using its ability to store and map dependencies on top of the normal way NPM works.
The meaning of this is that SystemJS will hold a map of simplified names and map them to where it downloaded the packages to (typically under ./jspm_packages).
If you're also testing using the Jest framework you will quickly learn that Jest can't find the dependencies used by your modules since it doesn't know where SystemJS placed them.
This is where this plugin comes in, it augments the moduleDirectories and moduleNameMapper configuration parameters with the info Jest needs to be able to find these aliased modules, whether they are downloaded or your own.
Install:
$ npm install --save-dev gulp-jest-jspm-es5 jest-cli
(note that jest-cli is a peer-dependency and is required to be installed as well)
In your gulpfile, require it:
const gulpJestJspm = require("gulp-jest-jspm-es5");
This plugin internally calls (gulp-jest) so you don't need to install it. However, if you wish you can use gulp-jest as a standalone plugin and simply pass it the generated configuration from this plugin (more on this below).
pass the path to the jest config to be loaded:
//test/client/jest.json
{
"verbose": true,
"setupTestFrameworkScriptFile": "<rootDir>/test/setupTests.js"
}
//gulpfile.js
gulp.task("jest", () =>
gulp.src("test/client") // where your tests are stored
.pipe(gulpJestJspm({
jestConfig: "test/client/jest.json" //jest.json is a simple JSON file
})));
Jest config can also be a module exporting an Object or a function that returns an Object:
//test/client/jest.js
module.export = () =>({
verbose: true,
setupTestFrameworkScriptFile: "<rootDir>/test/setupTests.js"
});
//gulpfile.js
gulp.task("jest", () =>
gulp.src("test/client") //where your tests are stored
.pipe(gulpJestJspm({
jestConfig: "test/client/jest.js" //jest.js exports an Object or a function
})));
Or you can pass jest configuration as an object
//gulpfile.js
gulp.task("jest", () =>
gulp.src("test/client") //where your tests are stored
.pipe(gulpJestJspm({
jestConfig:{
verbose: true,
setupTestFrameworkScriptFile: "<rootDir>/test/setupTests.js"
}
})));
In addition you can pass any of the following options to the plugin
jestConfig - config object or string path to config json file (default: {})
jestOptions - config object passed to the Jest-CLI (for example {debug: true}) (default: undefined)
systemJs - location of system js (default: "./jspm_packages/system")
sjsConfigFile - location of System JS config file (default: "./config")
loadSjsConfFile - whether to load the System JS config file (default: true)
jspmPackages - location of jspm packages (default: "./jspm_packages")
nodeModules - location of node modules dir (default: "./node_modules")
displayWarnings - whether the plugin will output warnings to console (default: false)
For example if your SystemJS files are located somewhere that is not the default you can do the following:
//gulpfile.js
gulp.task("jest", () =>
gulp.src("test/client") //where your tests are stored
.pipe(gulpJestJspm({
systemJs: "./libs/systemjs/systemjs.min.js",
sjsConfigFile: "./dist/config.js",
jestConfig:{
verbose: true,
setupTestFrameworkScriptFile: "<rootDir>/test/setupTests.js"
}
})));
Finally, if you're already using gulp-jest and don't wish to change to this plugin, you can get the generated configuration and pass it to the plugin call yourself:
//gulpfile.js
gulp.task("jest", () => {
const jestConf = gulpJestJspm.makeJestConfig(__dirname,
{jestConfig: "test/client/jest.json"}); //get the jest config
return gulp.src("test/client")
.pipe(gulpJest({config: jestConf})); //pass it to gulp-jest
});
alternatively, you can use jest-jspm directly from your gulp file. Which is basically what this package does.
Using jest-jspm-es5
now instead of jest-jspm
for compatibility issues.
Bug fix for bad export
FAQs
Gulp plugin for running Jest tests on JSPM/SystemJS apps in older versions of node
The npm package gulp-jest-jspm-es5 receives a total of 1 weekly downloads. As such, gulp-jest-jspm-es5 popularity was classified as not popular.
We found that gulp-jest-jspm-es5 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.