Skip to content

Commit

Permalink
split testing entrypoint of utils package
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed Nov 26, 2021
1 parent 1ebb8ee commit 51a1efa
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jest/setupFilesAfterEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @see https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";

import { getMswServer } from "@vulcanjs/utils";
import { getMswServer } from "@vulcanjs/utils/testing";
// MSW setup
// TODO: storybook test might already initialize a worker (in preview.js),
// not sure yet of the interaction between this worker and the server we create here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "@vulcanjs/graphql";
import { OneFieldGraphql, OneFieldType } from "./fixtures/graphqlModels";

import { getMswServer } from "@vulcanjs/utils";
import { getMswServer } from "@vulcanjs/utils/testing";

beforeEach(() => {
// add relevant mocks
Expand Down
3 changes: 0 additions & 3 deletions packages/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ export * from "./string";
export * from "./typescript";
export * from "./debug";
export * from "./url";

// test utils
export * from "./mswServer";
12 changes: 12 additions & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
"files": [
"dist/"
],
"exports": {
".": "./dist/index.js",
"./testing": "./dist/testing.js"
},
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"testing": [
"./dist/testing/index.d.ts"
]
}
},
"author": "eric-burel <eb@lebrun-burel.com>",
"homepage": "https://github.com/VulcanJS/vulcan-npm#readme",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions packages/utils/testing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Entry point for test dependencies, to avoid polluting the main build
*/
export * from "./mswServer";
6 changes: 5 additions & 1 deletion packages/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ const path = require("path");
const baseConfig = require("../../webpack/webpack.config.base.common.prod");
//const merge = require('webpack-merge')
module.exports = merge(baseConfig, {
entry: path.resolve(__dirname, "./index.ts"),
entry: {
index: path.resolve(__dirname, "./index.ts"),
testing: path.resolve(__dirname, "./testing.ts"),
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
},
});

0 comments on commit 51a1efa

Please sign in to comment.