Does not work with Jest in CommonJS
Details:
.../node_modules/.pnpm/[email protected]/node_modules/clet/lib/runner.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { EOL } from 'os';
^^^^^^
SyntaxError: Cannot use import statement outside a module
could you provide a mini example repository?
btw: plan to rewrite clet with ts then build esm and cjs, but honestly I don't have time recently.
Was running into this as well. I had to force Jest to transform a bunch of dependencies (including clet), and patch clet to not use import.meta.
@Mrtenz what do you mean you "patched" clet to not use import.meta? What doesn't the Babel transform @babel/plugin-syntax-import-meta work?
@Sweetog We're not using Babel to run tests, so we can't use that. Instead, I created a Yarn patch:
https://github.com/MetaMask/snaps/blob/1a0dd93ba3841c387bf6803d1d154d369bc4e45a/.yarn/patches/clet-npm-1.0.1-8523231bdc.patch#L36
This line seemed to be unnecessary, and it works fine without.
What are the ergonomics of best practices to clet to run in continuous integration environment? I do not need to use Jest, but I need to a "test runner" if you will. I could run a process that executes imports but than I might need to manage parallel tests running and consolidate assertion output and errors etc.
I definitely am having troubles using clet with my CLI and Jest because of ESM versus CommonJs mixture.
I have tried a plethora of babel-jest and babel transforms and just cannot get around the import.metaissue