diff options
Diffstat (limited to 'packages/test-utils')
-rw-r--r-- | packages/test-utils/.eslintrc.cjs | 6 | ||||
-rw-r--r-- | packages/test-utils/package.json | 17 | ||||
-rw-r--r-- | packages/test-utils/src/each.ts | 27 | ||||
-rw-r--r-- | packages/test-utils/src/index.ts | 22 | ||||
-rw-r--r-- | packages/test-utils/tsconfig.build.json | 10 | ||||
-rw-r--r-- | packages/test-utils/tsconfig.json | 12 |
6 files changed, 94 insertions, 0 deletions
diff --git a/packages/test-utils/.eslintrc.cjs b/packages/test-utils/.eslintrc.cjs new file mode 100644 index 0000000..548ea34 --- /dev/null +++ b/packages/test-utils/.eslintrc.cjs | |||
@@ -0,0 +1,6 @@ | |||
1 | module.exports = { | ||
2 | env: { | ||
3 | node: true, | ||
4 | browser: false, | ||
5 | }, | ||
6 | }; | ||
diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json new file mode 100644 index 0000000..9270af2 --- /dev/null +++ b/packages/test-utils/package.json | |||
@@ -0,0 +1,17 @@ | |||
1 | { | ||
2 | "name": "@sophie/test-utils", | ||
3 | "version": "0.1.0", | ||
4 | "private": true, | ||
5 | "sideEffects": false, | ||
6 | "type": "module", | ||
7 | "types": "dist/index.d.ts", | ||
8 | "scripts": { | ||
9 | "typecheck:workspace": "yarn g:typecheck", | ||
10 | "types": "yarn g:types" | ||
11 | }, | ||
12 | "dependencies": { | ||
13 | "@types/jest": "^27.4.0", | ||
14 | "jest": "^27.4.7", | ||
15 | "jest-each": "^27.4.6" | ||
16 | } | ||
17 | } | ||
diff --git a/packages/test-utils/src/each.ts b/packages/test-utils/src/each.ts new file mode 100644 index 0000000..c5271ae --- /dev/null +++ b/packages/test-utils/src/each.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com> | ||
3 | * | ||
4 | * This file is part of Sophie. | ||
5 | * | ||
6 | * Sophie is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU Affero General Public License as | ||
8 | * published by the Free Software Foundation, version 3. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Affero General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Affero General Public License | ||
16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | * SPDX-License-Identifier: AGPL-3.0-only | ||
19 | */ | ||
20 | |||
21 | import eachModule from 'jest-each'; | ||
22 | |||
23 | // Workaround for jest ESM loader incorrectly wrapping the import in another layer of `default`. | ||
24 | const each = | ||
25 | (eachModule as Partial<typeof import('jest-each')>).default ?? eachModule; | ||
26 | |||
27 | export default each; | ||
diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts new file mode 100644 index 0000000..5de84f1 --- /dev/null +++ b/packages/test-utils/src/index.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com> | ||
3 | * | ||
4 | * This file is part of Sophie. | ||
5 | * | ||
6 | * Sophie is free software: you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU Affero General Public License as | ||
8 | * published by the Free Software Foundation, version 3. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Affero General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Affero General Public License | ||
16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
17 | * | ||
18 | * SPDX-License-Identifier: AGPL-3.0-only | ||
19 | */ | ||
20 | |||
21 | // eslint-disable-next-line import/prefer-default-export -- More exports will be added here. | ||
22 | export { default as each } from './each'; | ||
diff --git a/packages/test-utils/tsconfig.build.json b/packages/test-utils/tsconfig.build.json new file mode 100644 index 0000000..d300514 --- /dev/null +++ b/packages/test-utils/tsconfig.build.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "extends": "../../config/tsconfig.base.json", | ||
3 | "compilerOptions": { | ||
4 | "composite": true, | ||
5 | "declarationDir": "dist", | ||
6 | "emitDeclarationOnly": true, | ||
7 | "rootDir": "src" | ||
8 | }, | ||
9 | "include": ["src/**/*.ts"] | ||
10 | } | ||
diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json new file mode 100644 index 0000000..d01eb81 --- /dev/null +++ b/packages/test-utils/tsconfig.json | |||
@@ -0,0 +1,12 @@ | |||
1 | { | ||
2 | "extends": "./tsconfig.build.json", | ||
3 | "compilerOptions": { | ||
4 | "composite": false, | ||
5 | "emitDeclarationOnly": false, | ||
6 | "declarationDir": null, | ||
7 | "noEmit": true, | ||
8 | "rootDir": null, | ||
9 | "types": ["@types/jest", "node"] | ||
10 | }, | ||
11 | "include": ["src/**/*.ts", ".eslintrc.cjs"] | ||
12 | } | ||