Skip to content

Commit

Permalink
[Tooling] Transpile tests targeting Node, not browser (#700)
Browse files Browse the repository at this point in the history
* transplite tests for higher target

* fix test

* add to lint-stagged too
  • Loading branch information
tinovyatkin authored and jshjohnson committed Oct 29, 2019
1 parent b48395c commit 1c75147
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
16 changes: 15 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -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
}
}
]
]
}
}
}
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/choices.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ describe('choices', () => {
...choices[0],
choices,
},
...choices[1],
choices[1],
];

beforeEach(() => {
Expand Down

0 comments on commit 1c75147

Please sign in to comment.