Skip to content

Upgrade to Jest 27 #1665

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

Merged
merged 5 commits into from
Feb 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/node_modules
/bin/configlet
/bin/configlet.exe
/pnpm-lock.yaml
/yarn.lock
23 changes: 14 additions & 9 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This track relies on [Node.js][web-nodejs] throughout to provide a runtime for JavaScript.
This means that we assume all execution of JavaScript on your computer will happen using [Node.js][web-nodejs].

# Track Requirements
## Track Requirements

Many machines come pre-installed with [Node.js][web-nodejs] or might have been installed previously, or as a dependency.
So before we do anything, we should check if it's already installed:
Expand Down Expand Up @@ -39,7 +39,7 @@ Both options support Windows, macOS, and Linux. If you don't know what to do, us
- We recommend using the **LTS** version. This is also indicated as _recommended_ on the [Node.js][web-nodejs] website "for most users".
- Follow the instructions on the webpage and/or during the installer and install [Node.js][web-nodejs].

### Testing the installation
## Testing the installation

After the installer is done, or the package manager has completed, or the binary has been copied and the instructions have been followed, it's good to test if everything is alright.

Expand All @@ -58,8 +58,8 @@ This means that the open terminals don't know that a new program was installed.
>
> On macOS and Linux you may accomplish this by adding the following to either `~/.bash_profile` or `~/.zshrc`:
>
> ```bash
> $ export PATH=/usr/local/share/npm/bin:$PATH
> ```shell
> export PATH=/usr/local/share/npm/bin:$PATH
> ```
>
> On Windows open the start menu and search for "environment variables".
Expand All @@ -69,23 +69,28 @@ This means that the open terminals don't know that a new program was installed.
>
> Close any open terminals and open a new one.

### Assignment Requirements
## Assignment Requirements

Please follow [these instructions][cli-walkthrough] to download the Exercism CLI for your OS.

Once the CLI is set up and configured, download the first exercise - `hello-world`:

```bash
$ exercism download --exercise=hello-world --track=javascript
```shell
exercism download --exercise=hello-world --track=javascript
```

Each assignment then needs some tools to run the tests.
They can be installed running this command within each assignment directory:

```bash
$ npm install
```shell
npm install
```

> _**Help**_: `'<package>' is missing / cannot be found`
>
> If you see this after _upgrading_ your exercise, welcome to npm 7.
> Delete `node_modules` and `package-lock.json` and re-run the command to resolve this.

If you're concerned about disk space and are okay installing another tool, take a look at [pnpm](https://pnpm.io/), which ensure only one copy of each package-version is ever installed on disk.
In this case, run `pnpm install` instead of `npm install`, and everything should work as expected.

Expand Down
12 changes: 6 additions & 6 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

Execute the tests with:

```bash
$ npm run test
```shell
npm run test
```

Be sure your code follows best practices and coding styles, as other users do, with ESLint, a tool to perform static analysis on your code.
Sometimes, tools like this save you some time detecting typos or silly mistakes in your JavaScript code:

```bash
$ npm run lint
```shell
npm run lint
```

You can also run Jest in "watch" mode, which will re-run your tests automatically when you save changes to the code or test module:

```bash
$ npm run watch
```shell
npm run watch
```

## Understanding Skip Tests
Expand Down
8 changes: 4 additions & 4 deletions exercises/concept/amusement-park/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/annalyns-infiltration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/bird-watcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/coordinate-transformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/custom-signs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/elyses-analytic-enchantments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/elyses-enchantments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/elyses-looping-enchantments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/factory-sensors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/freelancer-rates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
8 changes: 4 additions & 4 deletions exercises/concept/fruit-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
"devDependencies": {
"@exercism/babel-preset-javascript": "^0.1.2",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^26.0.24",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"babel-jest": "^27.5.0",
"core-js": "^3.21.0",
"eslint": "^8.8.0",
"jest": "^26.6.3"
"jest": "^27.5.0"
},
"dependencies": {},
"scripts": {
"test": "jest --no-cache ./*",
"watch": "jest --no-cache --watch ./*",
"test": "jest ./*",
"watch": "jest --watch ./*",
"lint": "eslint ."
}
}
Loading