wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
760 stars 45 forks source link

Error when trying sample project: https://github.com/wallabyjs/wallaby-std-esm #2989

Closed jlabrada71 closed 2 years ago

jlabrada71 commented 2 years ago

Issue description or question

I'm trying to use Wallaby with ES modules, and downloaded the sample project: https://github.com/wallabyjs/wallaby-std-esm It doesn't run. Throws an error: ​​[Error] SyntaxError: Unexpected token ','​​ ​​[Error] at new Script (vm.js:102:7)​​ .... Sender.fallbacks.js":void 0}]},{},[72]);,true​​

I guess is the last ',' before the 'true' the source of the error. The sample code is quite old maybe it requires to be updated.

I'm using node 14.17.5

Wallaby diagnostics 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: {
    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 } ],
    env: {
      type: 'node',
      params: { runner: '-r <homeDir>/Documents/sources/m2/wallaby-std-esm-master/node_modules/esm/esm.js' },
      runner: '/usr/bin/node',
      viewportSize: { width: 800, height: 600 },
      options: { width: 800, height: 600 },
      bundle: true
    },
    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: 'mocha@2.1.0', configurator: 'mocha@2.1.0', reporter: 'mocha@2.1.0', starter: 'mocha@2.1.0' },
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    loose: undefined,
    symlinkNodeModules: undefined,
    configCode: 'module.exports = function () {\n' +
      '  return {\n' +
      '    files: [\n' +
      "      'src/**/*.js',\n" +
      '    ],\n' +
      '    tests: [\n' +
      "      'tests/**/*.spec.js'\n" +
      '    ],\n' +
      '    env: {\n' +
      "      type: 'node',\n" +
      '      params: {\n' +
      "        runner: `-r ${require.resolve('esm')}`\n" +
      '      }\n' +
      '    }\n' +
      '  }\n' +
      '};'
  },
  packageJSON: { dependencies: { esm: '^3.0.6' }, devDependencies: undefined },
  fs: { numberOfFiles: 2 },
  debug: [
    '2022-05-17T01:26:42.628Z project Wallaby Node version: v14.17.5\n',
    '2022-05-17T01:26:42.628Z project Wallaby config: <homeDir>/Documents/sources/m2/wallaby-std-esm-master/wallaby.js\n',
    '2022-05-17T01:26:42.661Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/projects/3f275b69f494e5fc\n',
    '2022-05-17T01:26:42.715Z uiService Listening port 51235\n',
    '2022-05-17T01:26:42.717Z project package.json file change detected, invalidating local cache\n',
    '2022-05-17T01:26:42.740Z workers Parallelism for initial run: 6, for regular run: 3\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #0\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #1\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #2\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #3\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #4\n',
    '2022-05-17T01:26:42.741Z workers Starting run worker instance #5\n',
    '2022-05-17T01:26:42.741Z workers Web server is listening at 35995\n',
    '2022-05-17T01:26:42.742Z project File cache requires some updates, waiting required files from IDE\n',
    '2022-05-17T01:26:43.576Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.723Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.756Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.764Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.781Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.796Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:1\n' +
      'SyntaxError: Error parsing <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json: Unexpected token , in JSON at position 3540\n' +
      '    at JSON.parse (<anonymous>) {\n' +
      "  path: '<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/node_modules/source-map/package.json'\n" +
      '}\n' +
      '\n',
    '2022-05-17T01:26:43.832Z project Stopping process pool\n',
    '2022-05-17T01:26:43.834Z project Running postprocessor\n',
    '2022-05-17T01:26:43.839Z postprocessor New TypeScript language service is required\n',
    "2022-05-17T01:26:43.840Z postprocessor TypeScript postprocessor will be removed because in 2 project files none were found by patterns: [ '**/*.ts?(x)' ]\n",
    '2022-05-17T01:26:43.841Z project Postprocessor execution finished\n',
    '2022-05-17T01:26:43.841Z project Postprocessor is removed as requested by itself\n',
    '2022-05-17T01:26:43.841Z project Test run started; run priority: 3\n',
    '2022-05-17T01:26:43.841Z project Running all tests\n',
    '2022-05-17T01:26:43.842Z workers Starting test run, priority: 3\n',
    '2022-05-17T01:26:43.843Z nodeRunner Starting sandbox [worker #0, session #zvsku]\n',
    '2022-05-17T01:26:43.843Z nodeRunner Preparing sandbox [worker #0, session #zvsku]\n',
    '2022-05-17T01:26:52.750Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.751Z project Test run cancelled, re-queueing run data\n',
    '2022-05-17T01:26:52.751Z project Test run finished\n',
    '2022-05-17T01:26:52.751Z project Test run data re-queued\n',
    '2022-05-17T01:26:52.755Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.759Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.764Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.770Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.776Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:26:52.854Z project Test run started; run priority: 3\n',
    '2022-05-17T01:26:52.854Z project Running all tests\n',
    '2022-05-17T01:26:52.854Z workers Starting test run, priority: 3\n',
    '2022-05-17T01:26:52.854Z nodeRunner Starting sandbox [worker #0, session #zymkv]\n',
    '2022-05-17T01:26:52.854Z nodeRunner Preparing sandbox [worker #0, session #zymkv]\n',
    '2022-05-17T01:26:52.855Z workers Starting run worker instance #0\n',
    '2022-05-17T01:26:52.974Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:31\n' +
      'ws:"1.1.5"},devDependencies:{"@babel/core":"^7.10.4","@babel/generator":"^7.6.4","@babel/preset-env":"^7.12.11","@types/lodash":"^4.14.136","@types/node":"12.0.10","@types/semver":"^6.0.1","adm-zip":"^0.5.5","aws-sdk":"2.333.0","browserify-transform-tools":"1.5.0",chai:"4.2.0","chai-subset":"1.6.0",escodegen:"1.6.1","expect.js":"0.3.1",grunt:"1.0.3","grunt-browserify":"4.0.1","grunt-bump":"0.0.16","grunt-contrib-clean":"0.7.0","grunt-contrib-compress":"0.12.0","grunt-contrib-copy":"0.8.2","grunt-contrib-uglify":"0.11.0","grunt-run":"^0.8.1","grunt-ts":"^6.0.0-beta.22","javascript-obfuscator":"^0.18.1",jest:"^26.1.0","line-column":"^1.0.2","node-fetch":"^2.6.0",removeNPMAbsolutePaths:"1.0.4","typescript-cached-transpile":"0.0.6"},optionalDependencies:{keytar:"^4.10.0"},"private":!0}},{}],72:[function(e,t,i){var r,n,s,o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)},a=e("path"),l=function(){};try{Error.stackTraceLimit=80}catch(c){}if(process.env&&process.env.NODE_MODULES_OVERRIDE&&(console.warn(" ---- Using node modules from: "+process.env.NODE_MODULES_OVERRIDE+" ---- "),e("./lib/utils").nodeModulesLookup(function(e){e.unshift(process.env.NODE_MODULES_OVERRIDE)})),"worker"!==process.argv[2]&&"runner"!==process.argv[2]){if(!process.versions||!process.versions.pnp){var u=["cjs","js"],h=e("fs");u.reduce(function(t,i){if(t)return t;var r=a.join(process.cwd(),".pnp."+i);if(h.existsSync(r))try{return e(r).setup(),process.env.WALLABY_PNP="--require "+r,!0}catch(n){}return!1},!1)}l(),process.env.PWD=process.cwd(),process.env.DEBUG="wallaby:.*",process.env.DEBUG_COLORS="no",process.noDeprecation=!0,r=e("graceful-fs");var p=e("./lib/app"),d=e("commander"),f=!1;d.unknownOption=function(){},d.option("-p, --port <port>","specify port").option("-l, --projectCachePath <projectCachePath>","specify project cache location").option("-l, --configPath <configPath>","specify config file location").option("-l, --testsPath <testsPath>","specify tests location",function(e,t){return void 0===t?[e]:t.concat([e])},void 0).option("-l, --smartStart <smartStart>","specify wallaby start start").option("-k, --lkp [lkp]","specify lkp location").option("-c, --client [client]","specify client").option("-q, --quokka [quokka]","specify quokka").option("-q, --editorTypeScript [editorTypeScript]","specify editorTypeScript").option("-q, --homeDir <homeDir>","specify homeDir").option("-q, --cv <cv>","specify cv").option("-q, --ol <true|false>","specify ol").option("-q, --te <te>","specify te").option("-q, --fid <te>","specify fid").parse(process.argv);var g={port:47878,location:a.join(__dirname,"lib","project")};if(d.port&&(g.port=d.port),d.smartStart&&(g.testsPath=[]),d.projectCachePath&&!d.quokka){if(d.projectCachePath&&d.projectCachePath.endsWith("-wsl")&&r.existsSync("/run/WSL")){var v=a.basename(d.projectCachePath),y=a.join(e("os").homedir(),".wallaby");d.projectCachePath=a.join(y,"projects",v.substr(0,v.length-4)),r.existsSync(y)||r.mkdirSync(y)}if(g.projectCachePath=d.projectCachePath,"true"!==d.ol){if(!r.existsSync(g.projectCachePath))if(g.projectCachePath){var m=a.dirname(g.projectCachePath);r.existsSync(m)||(m?r.mkdirSync(m):console.error("No project cache parent directory: "+JSON.stringify(o(o({},d),{options:void 0})))),r.mkdirSync(g.projectCachePath)}else console.error("No project cache directory: "+JSON.stringify(o(o({},d),{options:void 0})));try{g.projectCachePath=r.realpathSync(d.projectCachePath)}catch(b){}}}if(d.configPath){g.configPath=d.configPath,"win32"===process.platform&&(g.configPath=g.configPath.split(a.sep).reduce(function(e,t){if(e){var i=r.readdirSync(e+a.sep);return e+a.sep+(i.find(function(e){return e===t})||i.find(function(e){return e.toLowerCase()===t.toLowerCase()})||t)}return t.toUpperCase()},""));var k=a.dirname(g.configPath);if(k!==process.cwd())try{process.chdir(a.dirname(k)),process.chdir(k)}catch(c){try{process.chdir(k)}catch(c){throw new Error("Wallaby.js working directory could not be initialized.")}}}if(void 0!==d.testsPath&&(g.testsPath=d.testsPath),"win32"===process.platform&&(g.projectCachePath&&":"===g.projectCachePath[1]&&(g.projectCachePath=g.projectCachePath.charAt(0).toUpperCase()+g.projectCachePath.slice(1)),g.configPath&&":"===g.configPath[1]&&(g.configPath=g.configPath.charAt(0).toUpperCase()+g.configPath.slice(1))),g.projectCachePath&&!process.env.quokka&&"true"!==d.ol)for(var T=g.projectCachePath,S=1;;){var C=a.join(g.projectCachePath,"running"),L={pid:process.pid,date:Date.now()};if(!r.existsSync(g.projectCachePath)){r.mkdirSync(g.projectCachePath),r.writeFileSync(C,JSON.stringify(L));break}if(!r.existsSync(C)){r.writeFileSync(C,JSON.stringify(L));break}var w=!1;try{var j=JSON.parse(r.readFileSync(C));w=process.kill(j.pid,0)}catch(c){w="EPERM"===c.code}if(!w){r.writeFileSync(C,JSON.stringify(L));break}g.projectCachePath=a.join(a.dirname(T),a.basename(T)+"_"+S),S++}if(d.editorTypeScript&&(g.editorTypeScript=d.editorTypeScript),d.homeDir&&(g.homeDir=d.homeDir),d.cv&&(g.cv=d.cv),d.ol&&(g.ol=d.ol),d.te&&(g.te=parseInt(d.te,10),g.te>=0||delete g.te),d.fid&&(g.fileId=d.fid),f=d.quokka,f&&(process.env.quokka=!0),e("./lib/serverUtils").initServerOptions(g),g.intervalAction=!0,f){var F={},x={},E={},R=function(e){return x[e]||E[a.dirname(e)]||!(!e||!~e.indexOf("quokka_fake_path")&&!~e.indexOf(a.join(process.cwd(),f.substr(0,f.lastIndexOf(".")))))};g.fileStructureCachePromise=function(e){return g.readFilePromise(e).then(function(e){return Q.when(JSON.parse(e))})};var I=g.fileStatPromise;g.fileStatPromise=function(e){if(R(e)){var t=F[e];return t?Q.when({size:t.content?t.content.length:0}):Q.reject(new Error("File "+e+" not found"))}return I(e)};var M=g.readFilePromise;g.readFilePromise=function(e){if(R(e)){var t=F[e];return t?Q.when(t.content):Q.reject(new Error("File "+e+" not found"))}return M(e)};var O=g.writeFilePromise;g.writeFilePromise=function(e,t){return R(e)?(F[e]={content:t},Q.when(!0)):O(e,t)};var P=g.unlinkFilePromise;g.unlinkFilePromise=function(e){return R(e)?(delete F[e],Q.when(!0)):P(e)};var q=g.unlinkFileSync;g.unlinkFileSync=function(e){return R(e)?void delete F[e]:q(e)};var N=g.writeFileSync;g.writeFileSync=function(e,t){return R(e)?void(F[e]={content:t}):N(e,t)};var A=g.readFileSync;g.readFileSync=function(e){if(R(e)){var t=F[e];if(!t)throw new Error("File "+e+" not found");return t.content}return A(e)};var D=g.fileExistsSync;g.fileExistsSync=function(e){return R(e)?!!F[e]:D(e)};var B=g.realpathSync;g.realpathSync=function(e){return R(e)?e:B(e)};var U=g.dirRemovePromise;g.dirRemovePromise=function(e){return R(e)?Q.when(e):U(e)};var H=g.dirRemoveSync;g.dirRemoveSync=function(e){return R(e)?e:H(e)};var V=g.dirEnsurePromise;g.dirEnsurePromise=function(e){return R(e)?Q.when(e):V(e)};var W=g.dirEnsureSync;g.dirEnsureSync=function(e){return R(e)?e:W(e)},g.useMemoryFs=function(e,t){t&&(E[a.dirname(e)]=!0),x[e]=!0;for(var i=e;i!==a.dirname(i);)i=a.dirname(i),x[i]=!0}}g.onStart=_.noop,g.onConnected=_.noop;var z=e("ws/lib/Sender.fallbacks.js");if(g._init=z.create,g.coreVersion=e("./package.json").version,"extended-core"===process.argv[2]||"extended-core-ws"===process.argv[2]||f)if("extended-core"!==process.argv[2]){g.quokka=f,g.client=d.client||"Sublime",g.lkp=d.lkp,g.Receiver=z.create();var K=e("ws").Server,J=new K({port:g.port,verifyClient:function(e){return _.verifyLocalOrigin(e.origin)}},function(){console.log(g.quokka?"quokka.js started":"wallaby.js started")});J.on("connection",function(t){var i={send:function(e){t.send(JSON.stringify(e))},receive:_.noop};g.onConnected(i),t.on("message",function(e){var t=JSON.parse(e);"stop"===t.type?process.exit():i.receive(t)}),i.send({type:"started",version:e("./package.json").version})})}else{g.client=d.client||"Atom",g.lkp=d.lkp;e("util");g.Receiver=z.create(),process.nextTick(function(){var e={send:function(e){process.send(e)},receive:_.noop};process.on("message",function(t){"connection"===t.type?g.onConnected(e):"stop"===t.type?process.exit():e.receive(t)}),e.send({type:"started",version:g.coreVersion})})}else{g.Receiver=e("./lib/project");var G=e("ws").Server,X=new G({port:g.port,verifyClient:function(e){return _.verifyLocalOrigin(e.origin)}},function(){console.log("wallaby.js started"),console.log("core v"+g.coreVersion)});X.on("connection",function(e){var t={send:function(t){e.send(JSON.stringify(t))},receive:_.noop};g.onConnected(t),e.on("message",function(e){t.receive(JSON.parse(e))})})}p.start(g)}else if("runner"!==process.argv[2])l(),process.noDeprecation=!0,e("./lib/global"),process.on("message",function(t){if(t&&"exit"===t.type)return void process.exit(0);if("instrumentor"===t.type){var i=e("./lib/instrumentor");try{var r=i(t.content,t.opts);process.send(r)}catch(n){process.send({error:{message:n&&n.message,stack:n&&n.stack}})}}else if("preprocessor"===t.type||"compiler"===t.type){var s=e("./lib/processor");try{s(t)["catch"](function(e){process.send({error:{message:e&&e.message,stack:e&&e.stack}})}).then(function(e){e&&process.send(e)})}catch(n){process.send({error:{message:n&&n.message,stack:n&&n.stack}})}}}),process.send("READY");else{if(process.env.WALLABY_ENV=!0,n=process.argv[7],n&&!process.env.quokka){var Y=function(e,t){for(var i=[],r=0;r<t.length;r++)i.push(t[r]),e[r]&&i.push(e[r]);for(;r<e.length;r++)i.push(e[r]);return i};r=e("fs");var Z=process.cwd(),$=a.dirname(n);s=a.join(Z,"node_modules"),Z!==$&&e("./lib/utils").nodeModulesLookup(function(e,t,i,r){var s=!1;e&&e[0]&&0===e[0].indexOf(Z)&&(s=!0,Array.prototype.splice.apply(e,[0,e.length].concat(Y(i.call(r,t.replace(Z,$)),e)))),s||e.push(n)},function(e){var t=e.replace(s,n);return t===e||r.existsSync(t)?t:e})}e("./lib/nodeTestWorker")(process.argv[3],process.argv[4],process.argv[5],process.argv[6],n,process.argv[8],process.argv[9],process.argv[10])}},{"./lib/app":7,"./lib/global":41,"./lib/instrumentor":42,"./lib/nodeTestWorker":45,"./lib/processor":59,"./lib/project":60,"./lib/serverUtils":62,"./lib/utils":70,"./package.json":71,commander:void 0,fs:void 0,"graceful-fs":void 0,os:void 0,path:void 0,"ts-node":void 0,util:void 0,ws:void 0,"ws/lib/Sender.fallbacks.js":void 0}]},{},[72]);,true\n' +
      '                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \n' +
      '\n' +
      "SyntaxError: Unexpected token ','\n" +
      '    at new Script (vm.js:102:7)\n' +
      '\n',
    '2022-05-17T01:27:02.862Z workers Worker is not created in time, recycling it\n',
    '2022-05-17T01:27:02.863Z project Test run cancelled, re-queueing run data\n',
    '2022-05-17T01:27:02.863Z project Test run finished\n',
    '2022-05-17T01:27:02.863Z project Test run data re-queued\n',
    '2022-05-17T01:27:02.964Z project Test run started; run priority: 3\n',
    '2022-05-17T01:27:02.964Z project Running all tests\n',
    '2022-05-17T01:27:02.965Z workers Starting test run, priority: 3\n',
    '2022-05-17T01:27:02.965Z nodeRunner Starting sandbox [worker #0, session #dgm21]\n',
    '2022-05-17T01:27:02.965Z nodeRunner Preparing sandbox [worker #0, session #dgm21]\n',
    '2022-05-17T01:27:02.965Z workers Starting run worker instance #0\n',
    '2022-05-17T01:27:03.121Z nodeRunner Error in worker: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.337/wallabya11068/server.js:31\n' +
      'ws:"1.1.5"},devDependencies:{"@babel/core":"^7.10.4","@babel/generator":"^7.6.4","@babel/preset-env":"^7.12.11","@types/lodash":"^4.14.136","@types/node":"12.0.10","@types/semver":"^6.0.1","adm-zip":"^0.5.5","aws-sdk":"2.333.0","browserify-transform-tools":"1.5.0",chai:"4.2.0","chai-subset":"1.6.0",escodegen:"1.6.1","expect.js":"0.3.1",grunt:"1.0.3","grunt-browserify":"4.0.1","grunt-bump":"0.0.16","grunt-contrib-clean":"0.7.0","grunt-contrib-compress":"0.12.0","grunt-contrib-copy":"0.8.2","grunt-contrib-uglify":"0.11.0","grunt-run":"^0.8.1","grunt-ts":"^6.0.0-beta.22","javascript-obfuscator":"^0.18.1",jest:"^26.1.0","line-column":"^1.0.2","node-fetch":"^2.6.0",removeNPMAbsolutePaths:"1.0.4","typescript-cached-transpile":"0.0.6"},optionalDependencies:{keytar:"^4.10.0"},"private":!0}},{}],72:[function(e,t,i){var r,n,s,o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)},a=e("path"),l=function(){};try{Error.stackTraceLimit=80}catch(c){}if(process.env&&process.env.NODE_MODULES_OVERRIDE&&(console.warn(" ---- Using node modules from: "+process.env.NODE_MODULES_OVERRIDE+" ---- "),e("./lib/utils").nodeModulesLookup(function(e){e.unshift(process.env.NODE_MODULES_OVERRIDE)})),"worker"!==process.argv[2]&&"runner"!==process.argv[2]){if(!process.versions||!process.versions.pnp){var u=["cjs","js"],h=e("fs");u.reduce(function(t,i){if(t)return t;var r=a.join(process.cwd(),".pnp."+i);if(h.existsSync(r))try{return e(r).setup(),process.env.WALLABY_PNP="--require "+r,!0}catch(n){}return!1},!1)}l(),process.env.PWD=process.cwd(),process.env.DEBUG="wallaby:.*",process.env.DEBUG_COLORS="no",process.noDeprecation=!0,r=e("graceful-fs");var p=e("./lib/app"),d=e("commander"),f=!1;d.unknownOption=function(){},d.option("-p, --port <port>","specify port").option("-l, --projectCachePath <projectCachePath>","specify project cache location").option("-l, --configPath <configPath>","specify config file location").option("-l, --testsPath <testsPath>","specify tests location",function(e,t){return void 0===t?[e]:t.concat([e])},void 0).option("-l, --smartStart <smartStart>","specify wallaby start start").option("-k, --lkp [lkp]","specify lkp location").option("-c, --client [client]","specify client").option("-q, --quokka [quokka]","specify quokka").option("-q, --editorTypeScript [editorTypeScript]","specify editorTypeScript").option("-q, --homeDir <homeDir>","specify homeDir").option("-q, --cv <cv>","specify cv").option("-q, --ol <true|false>","specify ol").option("-q, --te <te>","specify te").option("-q, --fid <te>","specify fid").parse(process.argv);var g={port:47878,location:a.join(__dirname,"lib","project")};if(d.port&&(g.port=d.port),d.smartStart&&(g.testsPath=[]),d.projectCachePath&&!d.quokka){if(d.projectCachePath&&d.projectCachePath.endsWith("-wsl")&&r.existsSync("/run/WSL")){var v=a.basename(d.projectCachePath),y=a.join(e("os").homedir(),".wallaby");d.projectCachePath=a.join(y,"projects",v.substr(0,v.length-4)),r.existsSync(y)||r.mkdirSync(y)}if(g.projectCachePath=d.projectCachePath,"true"!==d.ol){if(!r.existsSync(g.projectCachePath))if(g.projectCachePath){var m=a.dirname(g.projectCachePath);r.existsSync(m)||(m?r.mkdirSync(m):console.error("No project cache parent directory: "+JSON.stringify(o(o({},d),{options:void 0})))),r.mkdirSync(g.projectCachePath)}else console.error("No project cache directory: "+JSON.stringify(o(o({},d),{options:void 0})));try{g.projectCachePath=r.realpathSync(d.projectCachePath)}catch(b){}}}if(d.configPath){g.configPath=d.configPath,"win32"===process.platform&&(g.configPath=g.configPath.split(a.sep).reduce(function(e,t){if(e){var i=r.readdirSync(e+a.sep);return e+a.sep+(i.find(function(e){return e===t})||i.find(function(e){return e.toLowerCase()===t.toLowerCase()})||t)}return t.toUpperCase()},""));var k=a.dirname(g.configPath);if(k!==process.cwd())try{process.chdir(a.dirname(k)),process.chdir(k)}catch(c){try{process.chdir(k)}catch(c){throw new Error("Wallaby.js working directory could not be initialized.")}}}if(void 0!==d.testsPath&&(g.testsPath=d.testsPath),"win32"===process.platform&&(g.projectCachePath&&":"===g.projectCachePath[1]&&(g.projectCachePath=g.projectCachePath.charAt(0).toUpperCase()+g.projectCachePath.slice(1)),g.configPath&&":"===g.configPath[1]&&(g.configPath=g.configPath.charAt(0).toUpperCase()+g.configPath.slice(1))),g.projectCachePath&&!process.env.quokka&&"true"!==d.ol)for(var T=g.projectCachePath,S=1;;){var C=a.join(g.projectCachePath,"running"),L={pid:process.pid,date:Date.now()};if(!r.existsSync(g.projectCachePath)){r.mkdirSync(g.projectCachePath),r.writeFileSync(C,JSON.stringify(L));break}if(!r.existsSync(C)){r.writeFileSync(C,JSON.stringify(L));break}var w=!1;try{var j=JSON.parse(r.readFileSync(C));w=process.kill(j.pid,0)}catch(c){w="EPERM"===c.code}if(!w){r.writeFileSync(C,JSON.stringify(L));break}g.projectCachePath=a.join(a.dirname(T),a.basename(T)+"_"+S),S++}if(d.editorTypeScript&&(g.editorTypeScript=d.editorTypeScript),d.homeDir&&(g.homeDir=d.homeDir),d.cv&&(g.cv=d.cv),d.ol&&(g.ol=d.ol),d.te&&(g.te=parseInt(d.te,10),g.te>=0||delete g.te),d.fid&&(g.fileId=d.fid),f=d.quokka,f&&(process.env.quokka=!0),e("./lib/serverUtils").initServerOptions(g),g.intervalAction=!0,f){var F={},x={},E={},R=function(e){return x[e]||E[a.dirname(e)]||!(!e||!~e.indexOf("quokka_fake_path")&&!~e.indexOf(a.join(process.cwd(),f.substr(0,f.lastIndexOf(".")))))};g.fileStructureCachePromise=function(e){return g.readFilePromise(e).then(function(e){return Q.when(JSON.parse(e))})};var I=g.fileStatPromise;g.fileStatPromise=function(e){if(R(e)){var t=F[e];return t?Q.when({size:t.content?t.content.length:0}):Q.reject(new Error("File "+e+" not found"))}return I(e)};var M=g.readFilePromise;g.readFilePromise=function(e){if(R(e)){var t=F[e];return t?Q.when(t.content):Q.reject(new Error("File "+e+" not found"))}return M(e)};var O=g.writeFilePromise;g.writeFilePromise=function(e,t){return R(e)?(F[e]={content:t},Q.when(!0)):O(e,t)};var P=g.unlinkFilePromise;g.unlinkFilePromise=function(e){return R(e)?(delete F[e],Q.when(!0)):P(e)};var q=g.unlinkFileSync;g.unlinkFileSync=function(e){return R(e)?void delete F[e]:q(e)};var N=g.writeFileSync;g.writeFileSync=function(e,t){return R(e)?void(F[e]={content:t}):N(e,t)};var A=g.readFileSync;g.readFileSync=function(e){if(R(e)){var t=F[e];if(!t)throw new Error("File "+e+" not found");return t.content}return A(e)};var D=g.fileExistsSync;g.fileExistsSync=function(e){return R(e)?!!F[e]:D(e)};var B=g.realpathSync;g.realpathSync=function(e){return R(e)?e:B(e)};var U=g.dirRemovePromise;g.dirRemovePromise=function(e){return R(e)?Q.when(e):U(e)};var H=g.dirRemoveSync;g.dirRemoveSync=function(e){return R(e)?e:H(e)};var V=g.dirEnsurePromise;g.dirEnsurePromise=function(e){return R(e)?Q.when(e):V(e)};var W=g.dirEnsureSync;g.dirEnsureSync=function(e){return R(e)?e:W(e)},g.useMemoryFs=function(e,t){t&&(E[a.dirname(e)]=!0),x[e]=!0;for(var i=e;i!==a.dirname(i);)i=a.dirname(i),x[i]=!0}}g.onStart=_.noop,g.onConnected=_.noop;var z=e("ws/lib/Sender.fallbacks.js");if(g._init=z.create,g.coreVersion=e("./package.json").version,"extended-core"===process.argv[2]||"extended-core-ws"===process.argv[2]||f)if("extended-core"!==process.argv[2]){g.quokka=f,g.client=d.client||"Sublime",g.lkp=d.lkp,g.Receiver=z.create();var K=e("ws").Server,J=new K({port:g.port,verifyClient:function(e){return _.verifyLocalOrigin(e.origin)}},function(){console.log(g.quokka?"quokka.js started":"wallaby.js started")});J.on("connection",function(t){var i={send:function(e){t.send(JSON.stringify(e))},receive:_.noop};g.onConnected(i),t.on("message",function(e){var t=JSON.parse(e);"stop"===t.type?process.exit():i.receive(t)}),i.send({type:"started",version:e("./package.json").version})})}else{g.client=d.client||"Atom",g.lkp=d.lkp;e("util");g.Receiver=z.create(),process.nextTick(function(){var e={send:function(e){process.send(e)},receive:_.noop};process.on("message",function(t){"connection"===t.type?g.onConnected(e):"stop"===t.type?process.exit():e.receive(t)}),e.send({type:"started",version:g.coreVersion})})}else{g.Receiver=e("./lib/project");var G=e("ws").Server,X=new G({port:g.port,verifyClient:function(e){return _.verifyLocalOrigin(e.origin)}},function(){console.log("wallaby.js started"),console.log("core v"+g.coreVersion)});X.on("connection",function(e){var t={send:function(t){e.send(JSON.stringify(t))},receive:_.noop};g.onConnected(t),e.on("message",function(e){t.receive(JSON.parse(e))})})}p.start(g)}else if("runner"!==process.argv[2])l(),process.noDeprecation=!0,e("./lib/global"),process.on("message",function(t){if(t&&"exit"===t.type)return void process.exit(0);if("instrumentor"===t.type){var i=e("./lib/instrumentor");try{var r=i(t.content,t.opts);process.send(r)}catch(n){process.send({error:{message:n&&n.message,stack:n&&n.stack}})}}else if("preprocessor"===t.type||"compiler"===t.type){var s=e("./lib/processor");try{s(t)["catch"](function(e){process.send({error:{message:e&&e.message,stack:e&&e.stack}})}).then(function(e){e&&process.send(e)})}catch(n){process.send({error:{message:n&&n.message,stack:n&&n.stack}})}}}),process.send("READY");else{if(process.env.WALLABY_ENV=!0,n=process.argv[7],n&&!process.env.quokka){var Y=function(e,t){for(var i=[],r=0;r<t.length;r++)i.push(t[r]),e[r]&&i.push(e[r]);for(;r<e.length;r++)i.push(e[r]);return i};r=e("fs");var Z=process.cwd(),$=a.dirname(n);s=a.join(Z,"node_modules"),Z!==$&&e("./lib/utils").nodeModulesLookup(function(e,t,i,r){var s=!1;e&&e[0]&&0===e[0].indexOf(Z)&&(s=!0,Array.prototype.splice.apply(e,[0,e.length].concat(Y(i.call(r,t.replace(Z,$)),e)))),s||e.push(n)},function(e){var t=e.replace(s,n);return t===e||r.existsSync(t)?t:e})}e("./lib/nodeTestWorker")(process.argv[3],process.argv[4],process.argv[5],process.argv[6],n,process.argv[8],process.argv[9],process.argv[10])}},{"./lib/app":7,"./lib/global":41,"./lib/instrumentor":42,"./lib/nodeTestWorker":45,"./lib/processor":59,"./lib/project":60,"./lib/serverUtils":62,"./lib/utils":70,"./package.json":71,commander:void 0,fs:void 0,"graceful-fs":void 0,os:void 0,path:void 0,"ts-node":void 0,util:void 0,ws:void 0,"ws/lib/Sender.fallbacks.js":void 0}]},{},[72]);,true\n' +
      '                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            \n' +
      '\n' +
      "SyntaxError: Unexpected token ','\n" +
      '    at new Script (vm.js:102:7)\n' +
      '\n'
ArtemGovorov commented 2 years ago

The sample code is quite old maybe it requires to be updated.

Thanks, we have updated the sample esm dependency version, so it now works.

Also, depending on the testing framework that you are using, you may not need esm to run ES modules. You may find more details for various frameworks here.