Skip to content

Commit

Permalink
update vulcan next config
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-burel committed May 3, 2022
1 parent 3b916ed commit 3024cf1
Show file tree
Hide file tree
Showing 5 changed files with 819 additions and 659 deletions.
28 changes: 15 additions & 13 deletions jest.config.js
Expand Up @@ -10,7 +10,7 @@ const commonConfig = {
// have a better support of ESM, @see https://jestjs.io/fr/docs/ecmascript-modules
// https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
// and https://bl.ocks.org/rstacruz/511f43265de4939f6ca729a3df7b001c
"^.+\\.(js|jsx|ts|tsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.(js|jsx|ts|tsx|mjs)$": "babel-jest",
},
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
testPathIgnorePatterns: [
Expand Down Expand Up @@ -162,11 +162,17 @@ const commonConfig = {
// This option allows use of a custom test runner
// testRunner: "jasmine2",

/*
testEnvironmentOptions: {
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
url: 'https://jestjs.io'
}*/

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
/*
fakeTimers: {
enableGlobally: true
}*/

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
Expand Down Expand Up @@ -214,9 +220,8 @@ module.exports = {
projects: [
{
...commonConfig,
name: "client",
displayName: "client",
// testEnvironment: "jsdom", // defautl already
testEnvironment: "jsdom",
testMatch: ["**/!(*.server).test.[jt]s?(x)"],
modulePaths: ["<rootDir>"],
// The paths to modules that run some code to configure or set up the testing environment before each test
Expand All @@ -225,7 +230,6 @@ module.exports = {
},
{
...commonConfig,
name: "server",
displayName: "server",
testEnvironment: "node",
testMatch: ["**/*.server.test.[jt]s?(x)"],
Expand All @@ -235,21 +239,19 @@ module.exports = {
// integration tests
{
...commonConfig,
name: "integration-server",
displayName: "integration-server",
testEnvironment: "node",
displayName: "integration-client",
testEnvironment: "jsdom",
roots: undefined,
rootDir: ".",
testMatch: ["<rootDir>/test/integration/server/**/*.test.[jt]s?(x)"],
testMatch: ["<rootDir>/test/integration/client/**/*.test.[jt]s?(x)"],
},
{
...commonConfig,
name: "integration-client",
displayName: "integration-client",
displayName: "integration-server",
testEnvironment: "node",
roots: undefined,
rootDir: ".",
testMatch: ["<rootDir>/test/integration/client/**/*.test.[jt]s?(x)"],
testMatch: ["<rootDir>/test/integration/server/**/*.test.[jt]s?(x)"],
},
],
};
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -45,14 +45,15 @@
"@types/node": "^13.7.6",
"@types/react": "^17",
"auto-changelog": "^2.2.1",
"babel-jest": "^26.3.0",
"babel-jest": "28",
"babel-loader": "^8.1.0",
"babel-plugin-import": "^1.13.3",
"babel-plugin-transform-define": "^2.0.0",
"cross-fetch": "^3.1.4",
"depcheck": "^1.4.1",
"esbuild": "^0.14.10",
"jest": "^26.4.2",
"jest": "28",
"jest-environment-jsdom": "^28.0.2",
"mock-apollo-client": "^1.1.0",
"mongoose": ">= 6",
"operation-name-mock-link": "^0.0.6",
Expand Down
17 changes: 11 additions & 6 deletions starters/next/jest.config.js
Expand Up @@ -6,7 +6,7 @@ const commonConfig = {
// transform: undefined,
transform: {
//"^.+\\.[jt]sx?$": "ts-jest",
"^.+\\.(js|jsx|ts|tsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.(js|jsx|ts|tsx|mjs)$": "babel-jest",
// MDX support
"^.+\\.(md|mdx)$": "jest-transformer-mdx",
},
Expand Down Expand Up @@ -180,10 +180,17 @@ const commonConfig = {
// testRunner: "jasmine2",

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
/*
testEnvironmentOptions: {
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
url: 'https://jestjs.io'
}*/

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
/*
fakeTimers: {
enableGlobally: true
}*/

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
Expand Down Expand Up @@ -222,9 +229,8 @@ module.exports = {
projects: [
{
...commonConfig,
name: "client",
displayName: "client",
// testEnvironment: "jsdom", // defautl already
testEnvironment: "jsdom",
// The glob patterns Jest uses to detect test files
testMatch: [
"**/__tests__/(!server)/**/*.[jt]s?(x)",
Expand All @@ -237,7 +243,6 @@ module.exports = {
},
{
...commonConfig,
name: "server",
displayName: "server",
testEnvironment: "node",
// The glob patterns Jest uses to detect test files
Expand Down
5 changes: 3 additions & 2 deletions starters/next/package.json
Expand Up @@ -91,7 +91,7 @@
"apollo-datasource-mongodb": "^0.5.2",
"apollo-server": "^3",
"apollo-server-express": "^3",
"babel-jest": "26.0.1",
"babel-jest": "28",
"babel-plugin-istanbul": "6.0.0",
"bcrypt": "^5.0.1",
"clsx": "^1.1.1",
Expand Down Expand Up @@ -146,6 +146,7 @@
"chalk": "^4.1.2",
"eslint": "^7.32.0",
"graphql-voyager": "^1.0.0-rc.31",
"jest-environment-jsdom": "^28.0.2",
"mongodb-memory-server": "^8.4.0",
"react-is": "^16.13.1",
"source-map-support": "^0.5.19",
Expand Down Expand Up @@ -182,7 +183,7 @@
"dotenv-cli": "^4.0.0",
"eslint-config-next": "^11.1.0",
"eslint-plugin-cypress": "2.11.1",
"jest": "^26.0.1",
"jest": "28",
"jest-transformer-mdx": "^2.2.0",
"nyc": "^15.1.0",
"serve": "^11.3.2",
Expand Down

0 comments on commit 3024cf1

Please sign in to comment.