Browse Source

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

* transplite tests for higher target

* fix test

* add to lint-stagged too
pull/716/head
Konstantin Vyatkin 2 years ago
committed by Josh Johnson
parent
commit
1c751472b2
  1. 16
      .babelrc
  2. 2
      lint-staged.config.js
  3. 6
      package.json
  4. 2
      src/scripts/choices.test.js

16
.babelrc

@ -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
lint-staged.config.js

@ -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
package.json

@ -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",

2
src/scripts/choices.test.js

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

Loading…
Cancel
Save