diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a68405..8a80c5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,6 +29,10 @@ jobs: paths: - ~/.cache/yarn + - run: + name: Building examples + command: yarn build + - run: name: Running tests command: yarn test diff --git a/examples/graphql-react-apollo/package.json b/examples/graphql-react-apollo/package.json index b7b642e..4108034 100644 --- a/examples/graphql-react-apollo/package.json +++ b/examples/graphql-react-apollo/package.json @@ -22,9 +22,10 @@ "build": "react-scripts build", "update": "npx msw init public", "cy:run": "cypress run", - "test": "yarn test:unit && yarn test:e2e", + "test": "yarn test:unit && yarn test:e2e && yarn test:build", "test:unit": "react-scripts test --env=jest-environment-jsdom-sixteen", "test:e2e": "start-server-and-test start http://localhost:3001 cy:run", + "test:build": "", "eject": "react-scripts eject" }, "eslintConfig": { diff --git a/examples/rest-react/package.json b/examples/rest-react/package.json index a1d3870..2b7eaf2 100644 --- a/examples/rest-react/package.json +++ b/examples/rest-react/package.json @@ -16,9 +16,10 @@ "build": "react-scripts build", "update": "npx msw init public", "cy:run": "cypress run", - "test": "yarn test:unit && yarn test:e2e", + "test": "yarn test:unit && yarn test:e2e && yarn test:build", "test:unit": "react-scripts test --env=jest-environment-jsdom-sixteen", "test:e2e": "start-server-and-test start http://localhost:3001 cy:run", + "test:build": "../../scripts/test-bundle-presence.sh build/static/js", "eject": "react-scripts eject" }, "eslintConfig": { diff --git a/examples/with-storybook/package.json b/examples/with-storybook/package.json index e8b4bac..4970e40 100644 --- a/examples/with-storybook/package.json +++ b/examples/with-storybook/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "storybook": "start-storybook -p 6006 -s public", - "build-storybook": "build-storybook", + "build": "build-storybook", "update": "npx msw init public", "test:storybook": "jest", "test": "start-server-and-test storybook http://localhost:6006 test:storybook" diff --git a/package.json b/package.json index 67304c2..07cd2b7 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "license": "MIT", "scripts": { "test": "lerna exec --scope=* --concurrency=1 yarn test", + "build": "lerna exec --scope=* --concurrency=1 yarn build", "update": "lerna exec --scope=* --concurrency=1 yarn update", "use-packed-msw": "scripts/use-packed-msw.sh" }, diff --git a/scripts/test-bundle-presence.sh b/scripts/test-bundle-presence.sh new file mode 100755 index 0000000..05176b6 --- /dev/null +++ b/scripts/test-bundle-presence.sh @@ -0,0 +1,9 @@ +MATCH=$(grep "msw" $1/**/*.js) + +if [ ! -z "$MATCH" ] +then + echo "Mock Service Worker is included in the production build. Please resolve that." + exit 1 +fi + +echo "Mock Servivce Worker is NOT included in the production build."