aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamal Carvalho <jamal@golang.org>2020-12-30 17:48:52 -0500
committerJamal Carvalho <jamal@golang.org>2021-01-05 15:57:20 +0000
commit43996f83cb0312e88a47543c19ee98c2d8bf368e (patch)
tree87916b85a2f7aba8da489e5d0a00a6256b97047e
parent309e95f7ed7b53c5f66a1bfcb973608477990a23 (diff)
downloadgo-x-pkgsite-43996f83cb0312e88a47543c19ee98c2d8bf368e.tar.xz
devtools: update jest config
This change updates the jest config to specify test environments separately for unit and e2e tests and adds the isolated modules option to the ts-jest config to improve test startup time. For golang/go#43361 Change-Id: I3fbfae2a42c26bd0eeb2d235dab1cced0c8701ea Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280711 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
-rw-r--r--devtools/config/jest.config.js6
-rw-r--r--package.json4
2 files changed, 7 insertions, 3 deletions
diff --git a/devtools/config/jest.config.js b/devtools/config/jest.config.js
index 1622999e..8aa1583d 100644
--- a/devtools/config/jest.config.js
+++ b/devtools/config/jest.config.js
@@ -2,5 +2,9 @@
module.exports = {
preset: 'ts-jest',
rootDir: '../../',
- testEnvironment: 'node',
+ globals: {
+ 'ts-jest': {
+ isolatedModules: true,
+ },
+ },
};
diff --git a/package.json b/package.json
index 00a9102b..e22a556d 100644
--- a/package.json
+++ b/package.json
@@ -17,8 +17,8 @@
"lint-css": "stylelint **/*.css",
"license-check": "jsgl --local .",
"test-typecheck": "tsc --noEmit",
- "test-unit": "jest --config devtools/config/jest.config.js content",
- "test-e2e": "jest --config devtools/config/jest.config.js e2e",
+ "test-unit": "jest --config devtools/config/jest.config.js --env=jsdom content",
+ "test-e2e": "jest --config devtools/config/jest.config.js --env=node e2e",
"test": "run-s test-*"
},
"dependencies": {