From b1b326cf9cded9d4aae85018c5cebf6bce88dbe9 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 30 Jan 2015 22:32:21 +1100 Subject: [PATCH] better self contained module tests - fixes #634 --- .../self-contained/modules-amd/actual.js | 1 + .../self-contained/modules-amd/expected.js | 6 ++++++ .../{runtime-amd => modules-amd}/options.json | 0 .../self-contained/modules-common/actual.js | 1 + .../self-contained/modules-common/expected.js | 5 +++++ .../self-contained/modules-system/actual.js | 1 + .../self-contained/modules-system/expected.js | 13 +++++++++++++ .../self-contained/modules-system/options.json | 3 +++ .../self-contained/modules-umd/actual.js | 1 + .../self-contained/modules-umd/expected.js | 12 ++++++++++++ .../self-contained/modules-umd/options.json | 3 +++ .../self-contained/runtime-amd/actual.js | 1 - .../self-contained/runtime-amd/expected.js | 6 ------ .../self-contained/runtime-commonjs/actual.js | 1 - .../self-contained/runtime-commonjs/expected.js | 5 ----- 15 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 test/fixtures/transformation/self-contained/modules-amd/actual.js create mode 100644 test/fixtures/transformation/self-contained/modules-amd/expected.js rename test/fixtures/transformation/self-contained/{runtime-amd => modules-amd}/options.json (100%) create mode 100644 test/fixtures/transformation/self-contained/modules-common/actual.js create mode 100644 test/fixtures/transformation/self-contained/modules-common/expected.js create mode 100644 test/fixtures/transformation/self-contained/modules-system/actual.js create mode 100644 test/fixtures/transformation/self-contained/modules-system/expected.js create mode 100644 test/fixtures/transformation/self-contained/modules-system/options.json create mode 100644 test/fixtures/transformation/self-contained/modules-umd/actual.js create mode 100644 test/fixtures/transformation/self-contained/modules-umd/expected.js create mode 100644 test/fixtures/transformation/self-contained/modules-umd/options.json delete mode 100644 test/fixtures/transformation/self-contained/runtime-amd/actual.js delete mode 100644 test/fixtures/transformation/self-contained/runtime-amd/expected.js delete mode 100644 test/fixtures/transformation/self-contained/runtime-commonjs/actual.js delete mode 100644 test/fixtures/transformation/self-contained/runtime-commonjs/expected.js diff --git a/test/fixtures/transformation/self-contained/modules-amd/actual.js b/test/fixtures/transformation/self-contained/modules-amd/actual.js new file mode 100644 index 0000000000..8d1420050a --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-amd/actual.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/test/fixtures/transformation/self-contained/modules-amd/expected.js b/test/fixtures/transformation/self-contained/modules-amd/expected.js new file mode 100644 index 0000000000..2fecce6c30 --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-amd/expected.js @@ -0,0 +1,6 @@ +define(["exports", "foo", "6to5-runtime/helpers"], function (exports, _foo, _to5RuntimeHelpers) { + "use strict"; + + var _to5Helpers = _to5RuntimeHelpers; + var foo = _to5Helpers.interopRequire(_foo); +}); \ No newline at end of file diff --git a/test/fixtures/transformation/self-contained/runtime-amd/options.json b/test/fixtures/transformation/self-contained/modules-amd/options.json similarity index 100% rename from test/fixtures/transformation/self-contained/runtime-amd/options.json rename to test/fixtures/transformation/self-contained/modules-amd/options.json diff --git a/test/fixtures/transformation/self-contained/modules-common/actual.js b/test/fixtures/transformation/self-contained/modules-common/actual.js new file mode 100644 index 0000000000..8d1420050a --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-common/actual.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/test/fixtures/transformation/self-contained/modules-common/expected.js b/test/fixtures/transformation/self-contained/modules-common/expected.js new file mode 100644 index 0000000000..b44940490e --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-common/expected.js @@ -0,0 +1,5 @@ +"use strict"; + +var _to5Helpers = require("6to5-runtime/helpers"); + +var foo = _to5Helpers.interopRequire(require("foo")); \ No newline at end of file diff --git a/test/fixtures/transformation/self-contained/modules-system/actual.js b/test/fixtures/transformation/self-contained/modules-system/actual.js new file mode 100644 index 0000000000..d4f5786183 --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-system/actual.js @@ -0,0 +1 @@ +foo(...bar); diff --git a/test/fixtures/transformation/self-contained/modules-system/expected.js b/test/fixtures/transformation/self-contained/modules-system/expected.js new file mode 100644 index 0000000000..75d03dab75 --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-system/expected.js @@ -0,0 +1,13 @@ +System.register(["6to5-runtime/helpers"], function (_export) { + "use strict"; + + var _to5Helpers; + return { + setters: [function (_to5RuntimeHelpers) { + _to5Helpers = _to5RuntimeHelpers; + }], + execute: function () { + foo.apply(undefined, _to5Helpers.toArray(bar)); + } + }; +}); \ No newline at end of file diff --git a/test/fixtures/transformation/self-contained/modules-system/options.json b/test/fixtures/transformation/self-contained/modules-system/options.json new file mode 100644 index 0000000000..ee42d8e1c8 --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-system/options.json @@ -0,0 +1,3 @@ +{ + "modules": "system" +} diff --git a/test/fixtures/transformation/self-contained/modules-umd/actual.js b/test/fixtures/transformation/self-contained/modules-umd/actual.js new file mode 100644 index 0000000000..8d1420050a --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-umd/actual.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/test/fixtures/transformation/self-contained/modules-umd/expected.js b/test/fixtures/transformation/self-contained/modules-umd/expected.js new file mode 100644 index 0000000000..99db3c218f --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-umd/expected.js @@ -0,0 +1,12 @@ +(function (factory) { + if (typeof define === "function" && define.amd) { + define(["exports", "foo", "6to5-runtime/helpers"], factory); + } else if (typeof exports !== "undefined") { + factory(exports, require("foo"), require("6to5-runtime/helpers")); + } +})(function (exports, _foo, _to5RuntimeHelpers) { + "use strict"; + + var _to5Helpers = _to5RuntimeHelpers; + var foo = _to5Helpers.interopRequire(_foo); +}); \ No newline at end of file diff --git a/test/fixtures/transformation/self-contained/modules-umd/options.json b/test/fixtures/transformation/self-contained/modules-umd/options.json new file mode 100644 index 0000000000..1683480119 --- /dev/null +++ b/test/fixtures/transformation/self-contained/modules-umd/options.json @@ -0,0 +1,3 @@ +{ + "modules": "umd" +} diff --git a/test/fixtures/transformation/self-contained/runtime-amd/actual.js b/test/fixtures/transformation/self-contained/runtime-amd/actual.js deleted file mode 100644 index 09493dc9be..0000000000 --- a/test/fixtures/transformation/self-contained/runtime-amd/actual.js +++ /dev/null @@ -1 +0,0 @@ -import foo from "someModule"; diff --git a/test/fixtures/transformation/self-contained/runtime-amd/expected.js b/test/fixtures/transformation/self-contained/runtime-amd/expected.js deleted file mode 100644 index 169a62020f..0000000000 --- a/test/fixtures/transformation/self-contained/runtime-amd/expected.js +++ /dev/null @@ -1,6 +0,0 @@ -define(["exports", "someModule", "6to5-runtime/helpers"], function (exports, _someModule, _to5RuntimeHelpers) { - "use strict"; - - var _to5Helpers = _to5RuntimeHelpers; - var foo = _to5Helpers.interopRequire(_someModule); -}); diff --git a/test/fixtures/transformation/self-contained/runtime-commonjs/actual.js b/test/fixtures/transformation/self-contained/runtime-commonjs/actual.js deleted file mode 100644 index 9e9515cece..0000000000 --- a/test/fixtures/transformation/self-contained/runtime-commonjs/actual.js +++ /dev/null @@ -1 +0,0 @@ -import * as foo from "someModule"; diff --git a/test/fixtures/transformation/self-contained/runtime-commonjs/expected.js b/test/fixtures/transformation/self-contained/runtime-commonjs/expected.js deleted file mode 100644 index ca5d8978bb..0000000000 --- a/test/fixtures/transformation/self-contained/runtime-commonjs/expected.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -var _to5Helpers = require("6to5-runtime/helpers"); - -var foo = _to5Helpers.interopRequireWildcard(require("someModule"));