wavded / babel-tape-runner

Babel + Tape runner for your ESNext code
134 stars 16 forks source link

SyntaxError: Unexpected token import running tape tests #10

Closed veeracs closed 8 years ago

veeracs commented 8 years ago

Below command runs good in my local environment, but throws an error on the build server with same nodejs/npm (Node.JS v4.2.5, NPM 2.14.12) version as local. Any clues as what might be the issue here. Is babel transpilation is not happening correctly with this module? The project has no global npm package installs.

babel-tape-runner tests/*/.js | faucet /var/lib/jenkins/workspace/FusionDevTest/tests/unit/app/components/Button.js:1 (function (exports, require, module, filename, dirname) { import React from 'react'; ^^^^^^ SyntaxError: Unexpected token import at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:387:25) at loader (/var/lib/jenkins/workspace/FusionDevTest/node_modules/babel-register/lib/node.js:130:5) at Object.require.extensions.(anonymous function) as .js at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17) at require (internal/module.js:16:19) at Object. (app-unit-spec.js:1:1) at Module._compile (module.js:413:34) not ok [1m[31m1[0m no plan found not ok [1m[31m2[0m no assertions found

veeracs commented 8 years ago
{
  "dependencies": {
    "babel-polyfill": "6.3.14",
    "chalk": "1.1.1",
    "classnames": "2.2.3",
    "express": "4.13.3",
    "history": "1.17.0",
    "http-proxy": "1.12.1",
    "immutable": "3.7.6",
    "invariant": "2.2.0",
    "pretty-error": "2.0.0",
    "query-string": "3.0.0",
    "react": "0.14.6",
    "react-dom": "0.14.6",
    "react-helmet": "2.3.1",
    "react-redux": "4.0.0",
    "react-router": "2.0.0-rc5",
    "react-router-redux": "2.1.0",
    "redux": "3.0.5",
    "redux-async-connect": "0.1.10",
    "redux-thunk": "1.0.3",
    "scroll-behavior": "0.3.0",
    "serialize-javascript": "1.1.2",
    "serve-favicon": "2.3.0",
    "superagent": "1.7.1",
    "warning": "2.1.0",
    "webpack-isomorphic-tools": "2.2.26"
  },
  "devDependencies": {
    "babel-core": "6.4.5",
    "babel-eslint": "5.0.0-beta6",
    "babel-loader": "6.2.1",
    "babel-preset-es2015": "6.3.13",
    "babel-preset-react": "6.3.13",
    "babel-preset-stage-0": "6.3.13",
    "babel-runtime": "6.3.19",
    "babel-tape-runner": "2.0.0",
    "concurrently": "1.0.0",
    "css-loader": "0.23.1",
    "eslint": "1.10.3",
    "eslint-config-airbnb": "4.0.0",
    "eslint-plugin-import": "0.12.1",
    "eslint-plugin-react": "3.16.1",
    "extend-tape": "1.1.0",
    "extract-text-webpack-plugin": "1.0.1",
    "faucet": "0.0.1",
    "file-loader": "0.8.5",
    "node-sass": "3.4.2",
    "postcss-loader": "0.8.0",
    "react-unit": "1.1.1",
    "sass-loader": "3.1.2",
    "style-loader": "0.13.0",
    "tape": "4.4.0",
    "tape-jsx-equals": "1.0.0",
    "url-loader": "0.5.7",
    "webpack": "1.12.11",
    "webpack-dev-server": "1.14.1"
  }
}
ManasJayanth commented 8 years ago

@veeracs Can you check if you have babel-cli installed?

veeracs commented 8 years ago

@prometheansacrifice, thank you for looking into it, I was able to resolve the issue.

cristiano-belloni commented 8 years ago

Hi, I have the same problem here. .babelrc is on stage 2, but still import in the test generates an error.

stevus commented 5 years ago

@veeracs Before you close this issue, what was your solution? Others might have the same problem (like myself).....

DonGiulio commented 4 years ago

same issue here, what was the solution?