I'm writing automated tests with webdriver.io. I'm using grunt/babelify/browserify so that I can write the tests in ES6. I have required some node modules in my script. I want to be able to NOT compile those node files into my distribution script, but simply print out the require statements as is since i'm still running the script server side. In other words, is there a way to carry over code "as is" with browserify? Here are the modules I'm requiring:
required libraries
var webdriverio = require('webdriverio');
var chai = require("chai");
chai.config.includeStack = true; // prints out full call stack
var expect = chai.expect;
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
Here is my grunt file:
module.exports = function (grunt) {
grunt.initConfig({
browserify: {
dist: {
options: {
transform: [
["babelify", {
loose: "all"
}]
]
},
files: {
// if the source file has an extension of es6 then
// we change the name of the source file accordingly.
// The result file's extension is always .js
"./dist/module.js": ["./modules/*"]
}
}
},
watch: {
scripts: {
files: ["./modules/*/*.js"],
tasks: ["browserify"]
}
}
});
grunt.loadNpmTasks("grunt-browserify");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("watch", ["watch"]);
grunt.registerTask("build", ["browserify"]);
};