wallabyjs / wallaby-std-esm Goto Github PK
View Code? Open in Web Editor NEWSample repo demonstrating https://github.com/standard-things/esm support
Sample repo demonstrating https://github.com/standard-things/esm support
I tried the updated version for this sample and it worked. I also followed the guidelines for ES modules and Jest and it didn't work. I ran the test from the command line with jest and it works, so, it seems like a problem with using the runner parameters when using wallaby. I'm attaching this same project modified following the guidelines for ES modules + Jest.
What can I be missing?
Given the state-of-art, having the jest+ES example working in the repository would be more useful than the ESM sample.
Kind regards,
Juan Labrada
Diagnostic report
{
editorVersion: '1.59.0',
pluginVersion: '1.0.337',
editorType: 'VSCode',
osVersion: 'linux 5.13.0-41-generic',
nodeVersion: 'v14.17.5',
coreVersion: '1.0.1268',
checksum: 'MzAzNmZjNjc0NzlhMWI3YTgxMjNjYzIzNmE5NzhkMWUsMTY4MzY3NjgwMDAwMCww',
config: {
env: { params: { runner: '--experimental-vm-modules' }, type: 'node', runner: '/usr/bin/node', viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
files: [ { pattern: 'src/**/*.js', ignore: false, trigger: true, load: true, instrument: true, order: 1 } ],
tests: [ { pattern: 'tests/**/*.spec.js', ignore: false, trigger: true, load: true, test: true, order: 2 } ],
diagnostics: {},
filesWithNoCoverageCalculated: [],
runAllTestsInAffectedTestFile: false,
updateNoMoreThanOneSnapshotPerTestFileRun: false,
compilers: { '**/*.?(lit)coffee?(.md)': [Function (anonymous)] },
preprocessors: {},
maxConsoleMessagesPerTest: 100,
autoConsoleLog: true,
delays: { run: 0, edit: 100, update: 0 },
workers: { initial: 0, regular: 0, recycle: false },
teardown: undefined,
hints: {
ignoreCoverage: '__REGEXP /ignore coverage|istanbul ignore/',
ignoreCoverageForFile: '__REGEXP /ignore file coverage/',
commentAutoLog: '?',
testFileSelection: { include: '__REGEXP /file\\.only/', exclude: '__REGEXP /file\\.skip/' }
},
automaticTestFileSelection: true,
runSelectedTestsOnly: false,
mapConsoleMessagesStackTrace: false,
extensions: {},
reportUnhandledPromises: true,
testFramework: { version: '[email protected]', configurator: '[email protected]', reporter: '[email protected]', starter: '[email protected]' },
slowTestThreshold: 75,
lowCoverageThreshold: 80,
loose: undefined,
symlinkNodeModules: true,
configCode: 'export default function (wallaby) {\n' +
' return {\n' +
' files: [\n' +
" 'src/**/*.js',\n" +
' ],\n' +
' tests: [\n' +
" 'tests/**/*.spec.js'\n" +
' ],\n' +
' env: {\n' +
" type: 'node',\n" +
' params: {\n' +
" runner: '--experimental-vm-modules'\n" +
' }\n' +
' }\n' +
' }\n' +
'}\n'
},
packageJSON: { dependencies: undefined, devDependencies: { jest: '^28.1.0' } },
fs: { numberOfFiles: 2 },
debug: [
'2022-05-17T14:03:44.916Z project Wallaby Node version: v14.17.5\n',
'2022-05-17T14:03:44.916Z project Wallaby config: <homeDir>/Documents/sources/m2/wallaby-std-jest/wallaby.js\n',
'2022-05-17T14:03:44.946Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/projects/1473ea62640f05dd\n',
'2022-05-17T14:03:45.000Z uiService Listening port 51235\n',
'2022-05-17T14:03:45.028Z workers Parallelism for initial run: 6, for regular run: 3\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #0\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #1\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #2\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #3\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #4\n',
'2022-05-17T14:03:45.029Z workers Starting run worker instance #5\n',
'2022-05-17T14:03:45.030Z workers Web server is listening at 33977\n',
'2022-05-17T14:03:45.076Z project Stopping process pool\n',
'2022-05-17T14:03:45.076Z project File cache is up-to-date, starting full test run\n',
'2022-05-17T14:03:45.078Z project Running postprocessor\n',
'2022-05-17T14:03:45.081Z postprocessor New TypeScript language service is required\n',
"2022-05-17T14:03:45.081Z postprocessor TypeScript postprocessor will be removed because in 2 project files none were found by patterns: [ '**/*.ts?(x)' ]\n",
'2022-05-17T14:03:45.083Z project Postprocessor execution finished\n',
'2022-05-17T14:03:45.083Z project Postprocessor is removed as requested by itself\n',
'2022-05-17T14:03:45.083Z project Test run started; run priority: 3\n',
'2022-05-17T14:03:45.083Z project Running all tests\n',
'2022-05-17T14:03:45.085Z workers Starting test run, priority: 3\n',
'2022-05-17T14:03:45.085Z nodeRunner Starting sandbox [worker #0, session #zwvhe]\n',
'2022-05-17T14:03:45.086Z nodeRunner Preparing sandbox [worker #0, session #zwvhe]\n',
'2022-05-17T14:03:45.203Z workers Started run worker instance (delayed) #0\n',
'2022-05-17T14:03:45.204Z nodeRunner Prepared sandbox [worker #0, session #zwvhe]\n',
'2022-05-17T14:03:45.204Z workers [worker #0, session #zwvhe] Running tests in sandbox\n',
'2022-05-17T14:03:45.219Z workers Sandbox (active) [zwvhe] error: ./tests/a.spec.js:2\n' +
"import a from '../src/aModule';\n" +
'^^^^^^\n' +
'\n' +
'SyntaxError: Cannot use import statement outside a module\n' +
' at wrapSafe (internal/modules/cjs/loader.js:988:16)\n' +
' at Module._compile (internal/modules/cjs/loader.js:1036:27)\n' +
' at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)\n' +
' at Module.load (internal/modules/cjs/loader.js:937:32)\n' +
' at Function.Module._load (internal/modules/cjs/loader.js:778:12)\n' +
' at Module.require (internal/modules/cjs/loader.js:961:19)\n' +
' at require (internal/modules/cjs/helpers.js:92:18)\n' +
' at Array.forEach (<anonymous>)\n' +
' at new Promise (<anonymous>)\n' +
' at WebSocket.emit (events.js:400:28)\n' +
' at afterWrite (internal/streams/writable.js:466:5)\n' +
' at onwrite (internal/streams/writable.js:446:7)\n' +
' at InflateRaw.afterTransform (internal/streams/transform.js:103:3)\n' +
' at Zlib.processCallback (zlib.js:608:8)\n',
'2022-05-17T14:03:45.225Z workers Started run worker instance (delayed) #2\n',
'2022-05-17T14:03:45.230Z workers Started run worker instance (delayed) #1\n',
'2022-05-17T14:03:45.235Z workers Started run worker instance (delayed) #3\n',
'2022-05-17T14:03:45.246Z workers Started run worker instance (delayed) #4\n',
'2022-05-17T14:03:45.254Z workers Started run worker instance (delayed) #5\n',
'2022-05-17T14:03:45.320Z workers [zwvhe] Run 0 test(s), skipped 0 test(s)\n',
'2022-05-17T14:03:45.321Z workers [zwvhe] Sandbox is responsive, closing it\n',
'2022-05-17T14:03:45.322Z project Test run finished\n',
'2022-05-17T14:03:45.323Z project Processed console.log entries\n',
'2022-05-17T14:03:45.323Z project Processed loading sequences\n',
'2022-05-17T14:03:45.323Z project Processed executed tests\n',
'2022-05-17T14:03:45.323Z project Processed code coverage\n',
'2022-05-17T14:03:45.329Z project Test run result processed and sent to IDE\n'
]
}
Hello,
I use pm2+esm-wallaby to start the project, but the following error occurs: "Parse is not defined".
Parse is a global object in the third-party package "parse-server".
const brand = await new Parse.Query('Brand').select('brandName').equalTo('objectId', brandId).first();
There is no need using import or require for Parse.Query.
What should I pay attention to when configuring esm-wallaby?
The following is the relevant configuration to start esm-wallaby in pm2:
"script": "index.js",
"node_args": "-r esm-wallaby",
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.