[Tooling] Transpile tests targeting Node, not browser (#700)

* transplite tests for higher target

* fix test

* add to lint-stagged too
This commit is contained in:
Konstantin Vyatkin 2019-10-29 10:05:37 -04:00 committed by Josh Johnson
parent b48395ce36
commit 1c751472b2
4 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,17 @@
{
"presets": [["@babel/preset-env", { "loose": true }]]
"presets": [["@babel/preset-env", { "loose": true }]],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": true
}
}
]
]
}
}
}

View File

@ -10,5 +10,5 @@ module.exports = {
],
'.codecov.yml': () =>
'curl -f --silent --data-binary @.codecov.yml https://codecov.io/validate',
'src/scripts/**/*.js': () => 'mocha',
'src/scripts/**/*.js': () => 'npm run test:unit',
};

View File

@ -8,14 +8,14 @@
"start": "run-p js:watch css:watch",
"build": "run-p js:build css:build",
"lint": "eslint src/scripts",
"coverage": "nyc --reporter=lcov --reporter=text --reporter=text-summary mocha",
"coverage": "NODE_ENV=test nyc --reporter=lcov --reporter=text --reporter=text-summary mocha",
"bundlesize": "bundlesize",
"cypress:run": "$(npm bin)/cypress run",
"cypress:open": "$(npm bin)/cypress open",
"cypress:ci": "cypress run --record --group --ci-build-id $GITHUB_SHA",
"test": "run-s test:unit test:e2e",
"test:unit": "mocha",
"test:unit:watch": "mocha --watch --inspect=5556",
"test:unit": "NODE_ENV=test mocha",
"test:unit:watch": "NODE_ENV=test mocha --watch --inspect=5556",
"test:e2e": "run-p --race start cypress:run",
"js:watch": "NODE_ENV=development node server.js",
"js:build": "webpack --config webpack.config.prod.js",

View File

@ -1331,7 +1331,7 @@ describe('choices', () => {
...choices[0],
choices,
},
...choices[1],
choices[1],
];
beforeEach(() => {