Skip to content

Commit

Permalink
Test that cjs tests still work when using es-modules.
Browse files Browse the repository at this point in the history
Adds an integration test that uses cjs modules but is called with
the --es-modules flag.
  • Loading branch information
harrysarson committed Feb 27, 2018
1 parent b28d2db commit e1ad789
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/integration/es-modules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,21 @@ describe('esModules', function () {
});
});
});

describe('loading of cjs tests when running with --experimental-modules and --dynamic-import', function () {
it('should load cjs test', function (done) {
this.timeout(1000);
run('es-modules/cjs-test.fixture.js', ['--es-modules', '--experimental-modules', '--harmony-dynamic-import'], function (err, res) {
if (err) {
done(err);
return;
}
assert.equal(res.pending, 0);
assert.equal(res.passing, 1);
assert.equal(res.failing, 0);
assert.equal(res.code, 0);
done();
});
});
});
});
3 changes: 3 additions & 0 deletions test/integration/fixtures/es-modules/cjs-module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

exports.cjs = 'cjs';
8 changes: 8 additions & 0 deletions test/integration/fixtures/es-modules/cjs-test.fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var cjs = require('./cjs-module').cjs;


describe('testing common js require', function () {
it('should be able to require cjs modules', function () {
assert(cjs, 'cjs');
});
});

0 comments on commit e1ad789

Please sign in to comment.