Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add globalSetup, globalTeardown and moduleDirectories as jest options #903

Merged
merged 3 commits into from
Feb 18, 2019

Conversation

mschipperheyn
Copy link
Contributor

@mschipperheyn mschipperheyn commented Jan 29, 2019

This change liberates three additional options that are imho crucial for testing server side development:

  • globalSetup: allow you to prep, and seed a database, start a server
  • globalTeardown: allow you to stop a database, stop a server, gracefully shutdown
  • moduleDirectories: The jest complement to .babelrc => module-resolver

module-resolver allows you to absolute import components that are not in node_modules, e.g. import TextInput from 'components/form/TextInput, where components is placed in src/components. It helps keep your code more readable and not have endless ../../../components style imports.

When you use this, jest also needs to know, and moduleDirectories is the key for it.

I didn't quite understand why these keys were blocked, but perhaps this is a relic of create-react-app that for obvious reasons doesn't bear the burden of server side testing.

@mschipperheyn mschipperheyn changed the base branch from master to next January 29, 2019 14:38
@mschipperheyn
Copy link
Contributor Author

I can see snyk is failing, but I don't have the right access level to be able to diagnose why

@jaredpalmer jaredpalmer merged commit 8ae5118 into jaredpalmer:next Feb 18, 2019
jaredpalmer added a commit that referenced this pull request Apr 16, 2019
* Upgrade Babel to v7, Jest to v23.6 (#775)

* Upgrade Babel to v7, Jest to v23.6

Fix the following examples

* with-custom-babel-config
* with-inferno
* with-preact
* with-react-native-web
* with-rax

* Mimic other CRA defaults

* Move to Circle 2.0

* Rename folder to .circleci

* Change image to 8.12.0

* Change to generic node:8

* Change name of the mdx example

* v3.0.0-alpha.0

* Remove polyfills, add treeshaking in production (#788)

* Sync with CRA 2

* Remove unused deps

* Remove array

* Add @babel/runtime as dependency for babel-preset-razzle (#845)

* Close #875. Only create one server watcher during development

* Bump file-loader to v3

* Remove yarn.lock

* Add @babel/core to razzle preset

* Upgrade react-loadable example

* v3.0.0-alpha.1

* fix: launchEditorEndpoint warning (#877)

* v3.0.0-alpha.2

* Bump bs-platform in reason-react example

* Bump some deps

* Remove dead code

* Upgrade to webpack-dev-server 3. Drop speedy fork

* [v3] Create razzle-plugin-eslint (#888)

* Remove eslint handling from razzle-plugin-typescript

* Remove parts from docs mentioning eslint

* Move eslint specific code over to razzle-plugin-eslint

* Add a temporary eslint-plugin-react setting

* Update to the latest eslint packages as defined in react-scripts

* Add globalSetup, globalTeardown and moduleDirectories as jest options (#903)

* add globalSetup, globalTeardown and moduleDirectories to jest allowed

* rerun tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants