From a57d4bbcd3fdebeef9a978771ce4f1d4bf7ac7f3 Mon Sep 17 00:00:00 2001 From: Adrien Antoine Date: Tue, 1 Mar 2016 13:53:32 +0000 Subject: [PATCH] test: added tests about the import syntax Added missing tests about using the import syntax --- test/fixtures/import.expected.js | 15 +++++++++++++++ test/fixtures/import.js | 9 +++++++++ test/index.spec.js | 8 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/fixtures/import.expected.js create mode 100644 test/fixtures/import.js diff --git a/test/fixtures/import.expected.js b/test/fixtures/import.expected.js new file mode 100644 index 0000000..1711968 --- /dev/null +++ b/test/fixtures/import.expected.js @@ -0,0 +1,15 @@ +'use strict'; + +var _a = require('../assets/le-test-lib/this/is/a.js'); + +var _a2 = _interopRequireDefault(_a); + +require('../assets/le-test-lib/b.less'); + +require('../assets/le-test-lib/and/a/file.css'); + +var _myRelativeTestLib = require('../assets/le-test-lib'); + +var _myRelativeTestLib2 = _interopRequireDefault(_myRelativeTestLib); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } \ No newline at end of file diff --git a/test/fixtures/import.js b/test/fixtures/import.js new file mode 100644 index 0000000..8ca8a64 --- /dev/null +++ b/test/fixtures/import.js @@ -0,0 +1,9 @@ + +import'my-relative-test-lib/this/is/a.js'; +import'my-relative-test-lib/b.less'; +import'my-relative-test-lib/and/a/file.css'; + +import test from 'my-relative-test-lib/this/is/a.js'; +import test2 from 'my-relative-test-lib'; + +// Rest of the file diff --git a/test/index.spec.js b/test/index.spec.js index 131dc0c..41dc33b 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -45,3 +45,11 @@ test('requiring files from the root', t => { const expected = read('fixtures/rootfolder.expected.js'); t.is(actual, expected); }); + + +test('using the import syntax', t => { + const actual = transformFile('fixtures/import.js', {config: './runtime.webpack.config.js'}).code; + const expected = read('fixtures/import.expected.js'); + + t.is(actual, expected); +});