Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/bundlers.webpack.test.js')
-rw-r--r--test/bundlers.webpack.test.js71
1 files changed, 0 insertions, 71 deletions
diff --git a/test/bundlers.webpack.test.js b/test/bundlers.webpack.test.js
deleted file mode 100644
index 3ee367b..0000000
--- a/test/bundlers.webpack.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-var vm = require("vm"),
- fs = require("fs"),
- expect = require("expect.js"),
- webpack = require("webpack"),
- configureWebpack = require("../lib/bundlers/webpack/configureWebpack.js");
-
-/**
- * Executes the source in a context that pretends to be a browser
- * @param {!String} src
- */
-function runInFakeBrowserContext(src, filename) {
- var context = {
- describe: describe,
- it: it,
- before: before,
- after: after,
- beforeEach: beforeEach,
- afterEach: afterEach,
- setTimeout: setTimeout,
- clearTimeout: clearTimeout,
- setInterval: setInterval,
- clearInterval: clearInterval,
- parseFloat: parseFloat,
- parseInt: parseInt,
- encodeURIComponent: function () {},
- decodeURIComponent: function () {},
- document: {},
- console: console,
- testEnv: "webpack"
- };
- context.window = context;
- vm.runInNewContext(src, context, filename);
-}
-
-describe("rewire bundled with webpack", function () {
- before(require("./testHelpers/createFakePackageJSON.js"));
- after(require("./testHelpers/removeFakePackageJSON.js"));
- it("should run all sharedTestCases without exception", function (done) {
- var webpackOptions,
- src,
- outputPath = __dirname + "/bundlers/webpack/bundle.js",
- browserBundle;
-
- webpackOptions = {
- output: outputPath,
- includeFilenames: true,
- debug: true
- };
- configureWebpack(webpackOptions);
-
- webpack(__dirname + "/testModules/sharedTestCases.js", webpackOptions, function onWebpackFinished(err, stats) {
- expect(err).to.be(null);
- expect(stats.errors).to.have.length(0);
- expect(stats.warnings).to.have.length(0);
-
- // Read generated source
- src = fs.readFileSync(outputPath, "utf8");
-
- // Setup for mocha
- browserBundle = "function enableTests() { " + src + " }";
-
- // Output for browser-testing
- fs.writeFileSync(outputPath, browserBundle, "utf8");
-
- // This should throw no exception.
- runInFakeBrowserContext(src, outputPath);
-
- done();
- });
- });
-}); \ No newline at end of file