Skip to content

Commit

Permalink
Merge pull request #1715 from openzim/migrate-to-esm-update-packages
Browse files Browse the repository at this point in the history
Packages updated. Configs changed to use ESM
  • Loading branch information
kelson42 authored Jan 18, 2023
2 parents 844e4d8 + e314b20 commit fbabd74
Show file tree
Hide file tree
Showing 48 changed files with 6,866 additions and 7,404 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:

- name: running test with codecov
run: REDIS=redis://127.0.0.1:6379 ZIMCHECK_PATH=`find .. -name zimcheck` npm run codecov
env:
S3_URL: ${{ secrets.S3_URL }}

- name: running test
run: npm run jest
Expand Down
24 changes: 14 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ npm ci

To run it (this is only an example):
```bash
./node_modules/.bin/ts-node ./src/cli.ts --mwUrl=https://bm.wikipedia.org --adminEmail=XXX
./node_modules/.bin/ts-node-esm ./src/cli.ts --mwUrl=https://bm.wikipedia.org --adminEmail=XXX
```

or
Expand Down Expand Up @@ -77,24 +77,28 @@ npm run test:e2e

To run a specfic test with collecting coverage:
```bash
npm run test:pattern-coverage test/e2e/localParsoid.test.ts
npm run test:pattern test/e2e/wikisource.e2e.test.ts -- --coverage
```

To run a specfic test with collecting coverage:
To run a specfic test without collecting coverage:
```bash
npm run test:pattern test/e2e/localParsoid.test.ts
npm run test:pattern test/e2e/wikisource.e2e.test.ts
```

To run a tests by regex pattern. Example which runs all e2e tests:
```bash
npm run test:pattern ^.*e2e.*\.test\.ts
```

For S3 tests to pass, create a '.env' file (at the root of your
MWoffliner code directory) where you will configure the following
keys:
MWoffliner code directory) where you will configure S3 URL
with credentials. Example:
```
BASE_URL_TEST=...
KEY_ID_TEST=...
BUCKET_NAME_TEST=...
SECRET_ACCESS_KEY_TEST=...
S3_URL=https://s3.region.amazonaws.com/?bucketName=S3_BUCKET_NAME&keyId=S3_KEY_ID&secretAccessKey=S3_ACCESS_KEY
```

... or just ensure the `S3_URL` environment variable is properly set.

## Debugging

There is a pre-configured debug config for
Expand Down
18 changes: 18 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
moduleFileExtensions: ["ts", "js"],
collectCoverage: false,
verbose: true,
transform: {
'^.+\\.ts?$': [
'ts-jest',
{
useESM: true,
},
],
},
}

18 changes: 0 additions & 18 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit fbabd74

Please sign in to comment.