Merge pull request #319 from spotify/rugvip/clidf

packages: use cli to test and lint core and cli
This commit is contained in:
Patrik Oldsberg
2020-03-19 13:02:16 +01:00
committed by GitHub
4 changed files with 15 additions and 8 deletions
+10 -2
View File
@@ -21,14 +21,22 @@ const path = require('path');
// manually extend @spotify/web-scripts/config/jest.config.js that is desired
if (fs.existsSync('jest.config.js')) {
module.exports = require(path.resolve('jest.config.js'));
} else if (fs.existsSync('jest.config.ts')) {
module.exports = require(path.resolve('jest.config.ts'));
} else {
const extraOptions = {};
// Use src/setupTests.ts as the default location for configuring test env
if (fs.existsSync('src/setupTests.ts')) {
extraOptions.setupFilesAfterEnv = ['<rootDir>/setupTests.ts'];
}
module.exports = {
// We base the jest config on web-scripts, it's pretty flat so we skip any complex merging of config objects
// Config can be found here: https://github.com/spotify/web-scripts/blob/master/packages/web-scripts/config/jest.config.js
...require('@spotify/web-scripts/config/jest.config.js'),
// Use src/setupTests.ts as the default location for configuring test env
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
...extraOptions,
// If the package has a jest object in package.json we merge that config in. This is the recommended
// location for configuring tests.
+2 -2
View File
@@ -7,8 +7,8 @@
"scripts": {
"exec": "npx ts-node ./src",
"build": "tsc --outDir dist --noEmit false --module CommonJS",
"lint": "web-scripts lint",
"test": "web-scripts test",
"lint": "backstage-cli lint",
"test": "backstage-cli test",
"start": "nodemon ."
},
"devDependencies": {
+3 -4
View File
@@ -7,11 +7,10 @@
"types": "dist/cjs/index.d.ts",
"scripts": {
"build": "tsc --outDir dist/cjs --noEmit false --module CommonJS",
"lint": "web-scripts lint",
"test": "web-scripts test"
"lint": "backstage-cli lint",
"test": "backstage-cli test"
},
"dependencies": {
"@spotify-backstage/cli": "^0.1.0",
"@material-ui/core": "^4.9.1",
"@material-ui/icons": "^4.9.1",
"@types/google-protobuf": "^3.7.2",
@@ -27,7 +26,7 @@
"recompose": "0.30.0"
},
"devDependencies": {
"@spotify/web-scripts": "^6.0.0",
"@spotify-backstage/cli": "^0.1.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",