Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit e90ebb1

Browse files
authored
[TEST] fix tests in es-webpack challenge (#18)
Remove unused e2e tests + make unit test work by introducing babel-jest
1 parent 95a511a commit e90ebb1

File tree

11 files changed

+865
-1411
lines changed

11 files changed

+865
-1411
lines changed

library/es-webpack/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ A new tab is automatically open in the browser with the url http://localhost:808
7878
##### Unit tests + Coverage
7979
`npm run test:unit:coverage`
8080

81-
##### E2E tests
82-
`npm run test:e2e`
83-
84-
##### E2E tests + Coverage
85-
`npm run test:e2e:coverage`
86-
8781
#### Build the _production_ bundle
8882
`npm run build`
8983

library/es-webpack/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['@babel/preset-env'],
3+
};

library/es-webpack/package-lock.json

Lines changed: 836 additions & 1287 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/es-webpack/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,25 @@
1212
"lint": "eslint \"*/**/*.js\" --max-warnings 0 --fix",
1313
"build": "webpack --config webpack.prod.js",
1414
"start": "webpack serve --open --config webpack.dev.js",
15-
"test": "run-s test:unit test:e2e",
15+
"test": "npm run test:unit",
1616
"test:unit": "jest --runInBand --config=./test/unit/jest.config.js",
17-
"test:unit:coverage": "npm run test:unit -- --coverage",
18-
"test:e2e": "cross-env DEBUG=bv:test:* JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1 jest --runInBand --detectOpenHandles --config=./test/e2e/jest.config.js",
19-
"test:e2e:coverage": "npm run test:e2e -- --coverage"
17+
"test:unit:coverage": "npm run test:unit -- --coverage"
2018
},
2119
"dependencies": {
2220
"mxgraph": "^4.2.2"
2321
},
2422
"devDependencies": {
23+
"@babel/core": "^7.14.3",
24+
"@babel/preset-env": "^7.14.2",
25+
"babel-jest": "^26.6.3",
2526
"css-loader": "^5.2.4",
2627
"eslint": "^7.24.0",
2728
"eslint-config-prettier": "^8.2.0",
2829
"eslint-plugin-prettier": "^3.4.0",
2930
"html-webpack-plugin": "^5.3.1",
3031
"jest": "^26.6.3",
3132
"jest-html-reporter": "^3.3.0",
32-
"jest-image-snapshot": "^4.4.1",
33-
"jest-playwright-preset": "^1.5.2",
3433
"npm-run-all": "^4.1.5",
35-
"playwright": "^1.10.0",
3634
"prettier": "^2.2.1",
3735
"rimraf": "^3.0.2",
3836
"style-loader": "^2.0.0",

library/es-webpack/src/graph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class BingoGraph extends mxgraph.mxGraph {
3838
'Welcome to the BINGO!',
3939
0,
4040
0,
41-
this.container.clientWidth,
42-
this.container.clientHeight,
41+
this.container ? this.container.clientWidth : 500,
42+
this.container ? this.container.clientHeight : 500,
4343
'strokeOpacity=0',
4444
);
4545
} finally {

library/es-webpack/test/e2e/config/jest.image.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

library/es-webpack/test/e2e/config/playwright.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

library/es-webpack/test/e2e/jest-playwright.config.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

library/es-webpack/test/e2e/jest.config.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

library/es-webpack/test/unit/jest.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module.exports = {
2+
verbose: true,
23
rootDir: '../..',
34
roots: ['./test/unit', './src'],
4-
testMatch: ['**/?(*.)+(spec|test).[t]s'],
5+
testMatch: ['**/?(*.)+(spec|test).js'],
56
testPathIgnorePatterns: ['/node_modules/', 'dist', 'src'],
67
transform: {
7-
'^.+\\.ts?$': 'ts-jest',
8+
'^.+\\.(js|jsx)$': 'babel-jest',
89
},
910
collectCoverageFrom: ['**/*.{ts,js}'],
1011
coveragePathIgnorePatterns: [

0 commit comments

Comments
 (0)