Closed semmel closed 3 years ago
Fixes #774
I left out the Node.js import test because it would require creating a new npm project and npm installing baconjs.
npm install
baconjs
Here is the code anyway:
// file: testBareImport.mjs import * as Bacon from 'baconjs'; import pkg from "chai"; const { assert } = pkg; describe("Bare ES6 import in Node.js", function() { it("passes smoke test", () => Bacon.sequentially(10, [1, 2, 3]) .map(x => x * x) .reduce(0, (acc, y) => acc +y) .toPromise() .then(sum => assert.equal(sum, 14)) ); it ("imports the ES6 classes", () => { // ES6 class constructors require 'new' // So while with ES5 constructor functions calls without 'new' // do not throw, calls to ES6 constructors throw TypeError assert.throws(() => {Bacon.Error("woo");}, TypeError); }); });
Execute with $mocha testBareImport.mjs.
$mocha testBareImport.mjs
Included in 3.0.17
Fixes #774
I left out the Node.js import test because it would require creating a new npm project and
npm install
ingbaconjs
.Here is the code anyway:
Execute with
$mocha testBareImport.mjs
.