-
-
Notifications
You must be signed in to change notification settings - Fork 779
Closed
Labels
DocumentationES2015+ES2015 and later revisionES2015 and later revisionESMHelp wantedgood first issuehacktoberfestpinned
Description
EcmaScript modules that run in an environment supporting them (meaning they haven't been transpiled using Babel to ES5) and export a default function of some kind cannot be stubbed, as ES namespaces are immutable per the spec. There is nothing Sinon can do about this, so we explicitly throw an error when you try to do this: 'ES Modules cannot be stubbed'.
But @jdalton has made esm, a runtime loader for Node that enables loading EcmaScript modules (*.mjs), and to allow stubbing using Sinon and the like, he has added the mutableNamespace option to esm.
There should be an article under our How to section that shows how one can set up npm to execute node using esm and the option, along with a test script.
References:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DocumentationES2015+ES2015 and later revisionES2015 and later revisionESMHelp wantedgood first issuehacktoberfestpinned