Skip to content

Commit 52b3943

Browse files
authored
test: quick node and browser e2e test after build (#2550)
* test: quick node and browser e2e test after build * ci: ensure browsers are available on CI
1 parent 5f520d2 commit 52b3943

19 files changed

+5360
-8
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ version: 2.1
22
orbs:
33
vault: contentful/vault@1
44
node: circleci/[email protected]
5+
browser-tools: circleci/[email protected]
56

67
executors:
78
docker-with-node:
89
docker:
9-
- image: cimg/node:18.19
10+
- image: 'cimg/node:18.20.1-browsers'
1011
working_directory: ~/build-and-test
1112

1213
commands:

eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
import eslint from '@eslint/js'
44
import tseslint from 'typescript-eslint'
5+
import globals from 'globals'
56

67
export default tseslint.config(
78
eslint.configs.recommended,
89
tseslint.configs.recommended,
10+
{
11+
languageOptions: {
12+
globals: {
13+
...globals.node,
14+
...globals.browser,
15+
createClient: true,
16+
},
17+
},
18+
},
919
// Library
1020
{
1121
files: ['lib/**/*'],

package-lock.json

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

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"scripts": {
2727
"clean": "rimraf dist",
2828
"build": "npm run clean && npm run build:modules && npm run build:standalone && npm run build:types",
29+
"postbuild": "npm run test:demo-projects",
2930
"build:modules": "BABEL_ENV=modules babel --extensions \".ts\" --extensions \".js\" lib -d dist/es-modules/",
3031
"build:standalone": "webpack && NODE_ENV=production webpack",
3132
"build:standalone:log": "NODE_ENV=production WEBPACK_MODE=log webpack --json --profile --progress > webpack-build-log.json && webpack-bundle-analyzer webpack-build-log.json",
@@ -48,6 +49,9 @@
4849
"test:browser": "npx playwright install && npx vitest --project browser-unit --run && npx vitest --project browser-integration --run",
4950
"test:version": "grep -r \"0.0.0-determined-by-semantic-release\" ./dist > /dev/null && echo \"version 0.0.0-determined-by-semantic-release found in output\" && exit 1 || exit 0",
5051
"test:size": "size-limit",
52+
"test:demo-projects": "npm run test:demo-node && npm run test:demo-browser",
53+
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && vitest --run ./test/output-integration/node",
54+
"test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run test",
5155
"test:prepush": "npm run build && npm run test:unit && npm run test:size",
5256
"prettier": "prettier --write '**/*.{jsx,js,ts,tsx}'",
5357
"prettier:check": "prettier --check '**/*.{jsx,js,ts,tsx}'",
@@ -65,7 +69,8 @@
6569
"@contentful/rich-text-types": "^16.6.1",
6670
"axios": "^1.7.9",
6771
"contentful-sdk-core": "^9.0.1",
68-
"fast-copy": "^3.0.0"
72+
"fast-copy": "^3.0.0",
73+
"globals": "^15.15.0"
6974
},
7075
"devDependencies": {
7176
"@babel/cli": "^7.24.6",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public/contentful*.js
2+
public/env.js
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Browser demo
2+
3+
This small demo application shows how the contentful-management.js library can be used in a browser client.
4+
Furthermore it is also used to test if the build bundles can be correctly accessed by a client.
5+
6+
To run the test execute:
7+
8+
```sh
9+
npm install && npm run test
10+
```

0 commit comments

Comments
 (0)